im watching this 4 years later and i just looked at the views on the first video and this one. so many ppl have stopped watching. they gave up, but your still here. props to you
@@Harrahi Same i get very excited when i see the video is about and its way cooler to have a TON of vids next as i watch 1 video daily to save stuff in my mind
@@Yesitsmehi you should look in your output for errors then look on the video and try to rewrite that small piece of script from the video again and again untils it correct
Thanks for this, it has been my millionth attempt at this (the highest I got was advanced) Also, could you try out the code that I have written in the comment section, it is one of the new comments
Alvinblox has advanced and deep tutorials so dev king is better but if you have like lots of time then alving blox is great because he explains everything deeply and understandably.
Yeah I liked how they were short and sweet explaining the basics of what you can and cant do. I dont need to learn everything about everything I just need a basis and then I can figure out the rest when I practice on my own. Seeing too much when Im just learning is very overwhelming.
Huge bump in confidence for sure. Thanks for all the cool videos, you're probably the only channel who was able to teach me something without me watching the video twice. Amazing.
@@TVDeveloperwhat's your level of coding right now? but ig, the easiest ways to learn are : watching and start doing after your learn some things ( after 1 episodes ), it won't let your tired and brain broke ( keep in mind u watch from #1 so its easier after every episodes)
doubles and floats are decimal numbers with doubles being 64-bit and floats being 32-bit. Doubles have more precision than floats do but for most cases floats are enough. Lua, by default, uses doubles (even when you set up a whole number)
Lol am learning java in my school and watching dev king telling that it might be confusing adding the same variable with 1 lol it seems to me just normal.... But who r new to scripting they gonna be confused
A cool way to use leaderboards is by adding a rank system. For example: if player.Name == "YourName" then Rank.Value = "Developer" else Rank.Value = "Player" end Also make sure to create an instance with a string value!
@@frockfor TDK said you could do: Points.Value = Points.Value + 1 (this adds 1 to points) another way is: Points.Value += 1 (this also adds 1 to points)
you dont understand how happy i was i keep searching up vids on how to do certain things but then i started watching your series and now i have a better understanding of scripting
@@paticat79 he prolly quit when u wrote already, very few people make it past the Beginner level .In fact, im there too. I want to be in the very few but its gonna be hard
Motivation boost: Don't try to make your dream game as fast as possible, try and use the stuff that you DO know to your advantage instead of just booking it straight to Shop Simulator. Secondary advice: I like to wait until the part of the script is finished being written before I write the code to get it into my memory better.
this is the first tutorial of the series where i learnt something new, in the previous episodes i knew everything because of studying free model scripts
tysm tap all the videos u made in this series helped me make a new game(including this one) cuz i am making a click simulator game thingy and after time 1 click will make u click more so thank u again for making this series
This is amazing I understood all of it you are born for teaching at first time I tried watching how to script they did too much in one video. They would from Leaderstats go to Filtering and then all other things and it would be hard to understand but you sticked to the point of the video thanks for the video subbed and joined discord.
If you still reply I’m having a problem with this video I have the new Roblox menu and it won’t show me the leaderboard and I have no idea if anyone else can I’m really confused about what I should do
I made this, it should work with the current leaderboard :)! game.Players.PlayerAdded:connect(function(player) local leaderstats = Instance.new("IntValue") leaderstats.Name = 'leaderstats' leaderstats.Value = 0 local Points = Instance.new("IntValue") Points.Name = 'Points' Points.Value = 0 leaderstats.Parent = player Points.Parent = leaderstats end)
if u want it to have a delay so u can't click it infinity times in a second this is the script for you (I hope you understood the sentence lol) local waiting = 0 script.Parent.ClickDetector.MouseClick:Connect(function(player) if waiting == 0 then waiting = 1 player.leaderstats.Points.Value += 1 wait(1) waiting = 0 end end)
Hi Dev King! I love all ur videos, they are clear and easy to understand. But i have one question, what is the (function(player) mean? Does it mean it creates a function that accesses the players? Thanks!
I'm pretty sure it's an internal function that is precoded into Roblox. It pretty much allows you to access the players tab remotely (I could be wrong because I'm just learning).
@@thesnedd7219 Bingo! You are correct! Though, I am responding to this message a year later... So I'm guessing you probably know by now. But hopefully, this was helpful to someone else! 😀
when i tried to do the script that made it so the stats go up by one, it kept saying that "leaderstats" wasn't a member of player. And when I was in the testing screen, I went into m character and it showed the folder "leaderstats". And it was exactly how I spelled it in the script too. Could you help me figure out what to do. Please and Thank You. Plus you make awesome content, it helps me alot with learning how to script. Thank you.
then just make it part:Touched(thing) and detect if that thing is a character, if it is get the player from character and then u can change the leaderstats thing, plus add a debounce script else it will glitch and give a lot of points
I'm a beginner scripter and very bad at scripting so this is probably a really bad script but i got this to work(put this in the script of the part you want to walk over) script.Parent.Touched:Connect(function(player) if game.Players:GetPlayerFromCharacter(player.Parent) then local PlayerPoints = game.Players:GetPlayerFromCharacter(player.Parent).leaderstats.Points PlayerPoints.Value = PlayerPoints.Value + 1 end end)
Hey man i love your videos, slowly developing away been a few years now, doing youtube for a year now too. But thanks for all the help half the stuff i've learnt is you the other the API. Hopefully one day i'll be a solo dev on your shark tank
Same idk why maybe bc this vid is a little bit old but he still explains things really good he is the only youtuber I could have understand anything from
@@dadonutmaker it did work for for me if you want to trouble shoot i suggest using a image to text converter with both of them and asking chatgpt what the difference between the two scripts are
If anybody wanna access the player's character that's in workspace you gotta do :CharacterAdded() for example: game.Players.PlayersAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local stats = Instance.new("Folder", char) stats.Name = "leaderstats" end) it's useful
Yes, but for any onlookers please don't put leaderstats in any players character. Also correct me if I'm wrong, we can also do Player.Character but just in case do .CharacterAdded(Character) because of any internet concerns.
local comment = "" i am watching this video after five years"" local thanks = ""and i have learned a lot form it thank you devking"" print(comment ) print(thanks)
to those who are having problems with the leader board here is the correct working script. game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new(“Folder”, player) leaderstats.Name = “leaderstats” local Points = Instance.new(“IntValue”, leaderstats) Points.Name = “Points” end) Now it’s okay to replace the “Points” with another currency. If you type exactly how I typed it here you will be able to have it working.
Pagers Development Instead of doing local leaderstats = Instance.new(“Folder”),player) leaderstats.Name = “leaderstats” Do this: local leaderstats = Instance.new(“Folder”) leaderstats.Parent = player leaderstats.Name = “leaderstats” -[[Putting the parent of the item in another line makes your script way faster, it’s way better]]
This tutorial was great also I found a good way to learn how to script quickly by combining his tutorials in one script and not to look at any tutorials while making the script and see if you have improved and I did it and I was able to make it so you get multipliers if you have a certain amount of points and I was so happy when I actually made the code work!
@@ComicleGaming I found the problem to mine, Value needs the capital V. and you need to name the Points .Name, "Points" or whatever you called the variable.
I didn't understand how you used "player"as parameter How does roblox recognise that "player" is the actual player of the game and not like variable or parameter?
In the Object browser. If you try to find the event. It's gonna be written like this fo an example : Touched(Instance thatTouch) Roblox will automaticly fill the parameter with the data described once you trigger the event. To get the paramater data, you use function :Connect(function("the parameter"). For example Touched:Connect(function(hit) So when something trigger the event by touching the referenced part. The paramater will be filled by the subject that touched it. Example if a part touched it, then it will br filled like this Touched:Connect(function(part)
It's so easy and interesting, that I watched all the series in like 4 days and it was lite. Like I was playing some games and watching TH-cam and a little I wach then this tutorial, it's very easy, thank you❤
Death tracker script for obbies I made :) game:GetService("Players").PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats"
Hey @Alex that getservice stuff is when you're trying to call something like Replicated storage, or, startergui and stuff like that. Watch Dev kings video for further information on that if I want
Guys remember this is the old script and you shouldn't put Click detector anymore in the script but you should in the part So it's script.Parent.MouseClick:Connect(function(player)
you don't have to make a variable you can do it in the second wat that he said script.Parent.ClickDetector.MouseClick:Connect(function(player) player.leaderstats.points.Value = player.leaderstats.points.Value + 1
I actually really enjoyed this video. After I learned how to make leaderboards, I sort of challenged myself to make a thing similar to cookie clicker, where you can spend a certain amount of points to buy a cursor and get it to automatically generate a certain amount of points after a certain amount of time.
@@r_odyy12 Sorry for the late response, but this is what I did: local player = game.Players.LocalPlayer local mouse = player:GetMouse() local cursor = script.Parent local playerpoints = player:WaitForChild("leaderstats").Points function addclicks() while true do wait(3) playerpoints.Value = playerpoints.Value + 10 end end cursor.Activated:Connect(function() if playerpoints.Value >= 50 then playerpoints.Value = playerpoints.Value - 50 addclicks() elseif playerpoints.Value
@@pavul9890 Realized that is a worthless idea ngl and I'm a way more advanced developer so I wouldn't think of such medicore cash grab ideas like that.
If you want a simplified way to do it, or without having to create 2 seperate scripts, it's: game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player) leaderstats.Name = "leaderstats"
local Points = Instance.new("IntValue", leaderstats) Points.Name = "Clicks" Points.Value = 0 script.Parent.ClickDetector.MouseClick:Connect(function() Points.Value = Points.Value + 1 end) end) (make sure you put the script inside the part with the ClickDetector)
@Choco Latte No. Because of how Roblox works, you need to 'save' the data the script makes. I didn't do that. Instead, I improved on the script TheDevKing gave in the video to simplify it for others.
If anybody is struggling to get this to work in a script longer than his, try to put this at the top of the script, especially before any wait commands, so that the function is ready before the first player loads. This mistake cost me 30 minutes of debugging time
should i be worried if i cant replicate this off memory when i need it or would i just need to understand it for now? same goes for the other beginner guides youve got
As long as you understand the key parts of the video, like how you create leaderstats, you should be good. You can always rewatch the tutorials if you forget them. Scripting is also 75% experimental so combining things you've already learnt with the things you have just learnt will for sure be a good way to get you not forgetting short term info
Finished the Tutorial, here's my finished Product ( I modified it for people to use) I edited it to make it better local Gold = Instance.new("Part",workspace) Gold.Name = "Gold" Gold.Position = Vector3.new(-44.245, 18.088, -4.809) Instance.new("ClickDetector", Gold) Gold.Color = Color3.fromRGB(255, 170, 0) Gold.Size = Vector3.new(5,5,5) Gold.Anchored = true local Sparkles = Instance.new("Sparkles",Gold) Sparkles.SparkleColor = Color3.fromRGB(115, 0, 173) local function Statistics() game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder",player) leaderstats.Name = "leaderstats"
local points = Instance.new("IntValue",leaderstats) points.Name = "EXP" points.Value = 0
game.Workspace.Gold.ClickDetector.MouseClick:Connect(function(player) wait() points.Value = points.Value + 10 if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end while true do wait() if Level.Value == 100 then points.Value = 100000000000 end end end) end) end Statistics() You can just create a script and paste it in there.
game.Workspace.Gold.ClickDetector.MouseClick:Connect(function(player) wait() points.Value = points.Value + 10 if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end if points.Value == 100 then Level.Value = Level.Value + 1 points.Value = 0 end Why r u repeating it?
so the folder is in the properties of the player but the leaderboard doesn't show up in the top right. is this just because of the new layout of roblox?
Im pretty sure you could use a if statement and check if the person has bought the id of the shirt/pant. If so, then add 1 to the value of the leaderstat you want. If they havent bought it, then do nothing and add 0.
@OK-kh8pl Yes, it is because for certain events there are built-in parameters. Player added returns the player who was added, mouse click returns the player who clicked.
BRO the dev king ik your videos are kinda old BUT HOLLY YOU HAVE TO BE THE BEST PERSON TO EXPLAIN CODE IN A WAY I UNDERSTAND I started code 2 days ago and watched your videos and now I know so much more
@@Corvus_the_wyvern me neither, but I found two datastore links if you want to check them out. I haven't watched them yet, but here you go: th-cam.com/video/DkYupSBUpes/w-d-xo.html th-cam.com/video/hBfMfB0BwGA/w-d-xo.html
It's funny. I wanted to make 2 intvaleus for 2 different leaderstats values but the second one always replaced the first one. Is this a new roblox update or something?
i am beginner and thankyou for the video. i am going to ask does that means every single time a player joined into the game their point will be resetted into 5? if not so where is their last point stored?
Hey guys! Be sure to join the discord server if you have any questions or if you would like to meet me! discord.gg/FKcSyRh
wouldn't the varible points and leaderstats be out of scope and have an error on the other script?
I have a question Idk if you will answer but what is your opinion on Alvin Blox
TheDevKing sorry but you seemed super nervous through the video
Your the best (:
Just make points.value = 0 then when ever u reset it will be 0 points
im watching this 4 years later and i just looked at the views on the first video and this one. so many ppl have stopped watching. they gave up, but your still here. props to you
Fr loads of ppl stop
thanks brudda
😂
@@kp4n Makes me realise how much motivation i actually have am almost finished with the advanced series but decided to refresh my memory
@@kp4nyh
When you become happy that you almost finished the series but you see how much episodes are ahead of you in the advanced series 😂
Dead
I just noticed... :(
idk bruh im pretty happy, this beginner tutorial was really short and im excited to look at more
@@Harrahi Same i get very excited when i see the video is about and its way cooler to have a TON of vids next as i watch 1 video daily to save stuff in my mind
@@HamzaIsBoredRn man 1 video daily, I might have to start doing that, I feel worried that I might forget stuff
For those who have watched since the first video of the series, don't give up yet you've gotten so far already!
Did this work for you because it didn't for me I think Lua might have gotten updated or something. I copied everything exactly.
Are you sure your capitals and spaces are correct those count to😅
@@Yesitsmehi you should look in your output for errors then look on the video and try to rewrite that small piece of script from the video again and again untils it correct
i gave up at remote events but im trying again
Thanks for this, it has been my millionth attempt at this (the highest I got was advanced)
Also, could you try out the code that I have written in the comment section, it is one of the new comments
alvinblox: *half hour tutorial on brick colors*
dev king: literally explains how to script in like a hour or two of a playlist
Alvinblox has advanced and deep tutorials so dev king is better but if you have like lots of time then alving blox is great because he explains everything deeply and understandably.
Yeah I liked how they were short and sweet explaining the basics of what you can and cant do. I dont need to learn everything about everything I just need a basis and then I can figure out the rest when I practice on my own. Seeing too much when Im just learning is very overwhelming.
100% true
@@NukeyStreams True
Alvin has more deep tutorials TDK has just to basic knowledge you need to know as @Nukey Stream's said (now @Nukey THE gamer)
Leaderboards are just one of those things I just keep in a playlist so when I inevitably forget how to make them, I can just watch this video again.
Huge bump in confidence for sure. Thanks for all the cool videos, you're probably the only channel who was able to teach me something without me watching the video twice. Amazing.
we’re you a dev before or after? lol
So what's your level of coding right now? Can you share some projects? I just started and I want to see your progress.
@@TVDeveloperwhat's your level of coding right now? but ig, the easiest ways to learn are : watching and start doing after your learn some things ( after 1 episodes ), it won't let your tired and brain broke ( keep in mind u watch from #1 so its easier after every episodes)
Subbed. Great scripting series. You teach really well!
Thanks :D be sure to watch from the start so you don't get confused
@Builderman Actually they are both good, Because they explaining for all to make these lessons easier.
@Builderman peasfactory is way better as he doesnt laugh all the time
@@Benere whats wrong with laugh? I mean TDK Is WAaaaaaayyyyyy better!
@@TheDevKing dje
Leaderboards are SO COOL! I always wanted to know how they work! :D Thanks, you truly are the Dev King 👨💻
Int values are whole numbers, doubles are integers. If anyone is confused (I do java).
java nice my whole family does to basically (kinda like our job) lol
@TalonsDev Really wow
doubles and floats are decimal numbers with doubles being 64-bit and floats being 32-bit. Doubles have more precision than floats do but for most cases floats are enough. Lua, by default, uses doubles (even when you set up a whole number)
roblox is powered by lua
Lol am learning java in my school and watching dev king telling that it might be confusing adding the same variable with 1 lol it seems to me just normal.... But who r new to scripting they gonna be confused
ive learned so much in a month of watching these videos, you got me taking detailed notes like im in school again
THATS WHAT IM DOING!! WE TWINNING!
@@NotSa7 me too 😄
So what's your level of coding right now? Can you share some projects? I just started and I want to see your progress.
same 😭😭😭
finally someone who uses click detectors not gui buttons i subbed
There is a different purpose for both
I like gui buttons
GUI button and ClickDetectors have different purposes
its the same but with a diferent function
A cool way to use leaderboards is by adding a rank system. For example:
if player.Name == "YourName" then
Rank.Value = "Developer"
else
Rank.Value = "Player"
end
Also make sure to create an instance with a string value!
For those that are looking for an easier form: number += 1 adds 1 to number too.
still dont understand
@@frockfor then youre dumb because this is the most basic thing ever lmfao
@@frockfor TDK said you could do:
Points.Value = Points.Value + 1 (this adds 1 to points)
another way is:
Points.Value += 1 (this also adds 1 to points)
@@qwerty_qwertyThis helps, thanks!
you dont understand how happy i was i keep searching up vids on how to do certain things but then i started watching your series and now i have a better understanding of scripting
this prob is the best scripting tutorial series
i've watched so many leaderstats video past year but only this tutorial explained very well. i watched ur all beginner tutorial and its just fits well
in one of my favourite games you get points by doing damage to your opponent how does it work?
in the weapon script detect when the weapon does damage then do the player.leaderstats + points thing
the 3rd last video for the beginner scripting series, oh man i can't wait!!
Did you ever learned 2 years later?
This man has already made me such a better scripter than before I’m still not good but I’m learning
How about now? 1 year
@@paticat79 he prolly quit when u wrote already, very few people make it past the Beginner level .In fact, im there too. I want to be in the very few but its gonna be hard
i got past beginner series does it count@@P0ro_S
@@P0ro_Show about 1 year I've im still stuck in beginner like I've watched it all but I cant seem to remember this script work for word
@@P0ro_S did you quit now?
Motivation boost: Don't try to make your dream game as fast as possible, try and use the stuff that you DO know to your advantage instead of just booking it straight to Shop Simulator. Secondary advice: I like to wait until the part of the script is finished being written before I write the code to get it into my memory better.
this is the first tutorial of the series where i learnt something new, in the previous episodes i knew everything because of studying free model scripts
lol same
tysm tap all the videos u made in this series helped me make a new game(including this one) cuz i am making a click simulator game thingy and after time 1 click will make u click more so thank u again for making this series
Can you please make more vids sooner, you are amazing. Ty
They are going to be uploaded every other day. That way people who are watching the serious it comes out don't feel rushed
@@TheDevKing Y did you say serious its series.
@@niccolodagruma that was a year ago ._. does it even matter lol
@Fast Fuz 5 d a y s a g o
@@practicalcucumber1395 lol
first
to like my own comment this is totally original
TheDevKing: it's a bit confusing not really but you might not understand it
Me: wow I have to keep watching it to remeber
take notes :p
This is amazing I understood all of it you are born for teaching at first time I tried watching how to script they did too much in one video. They would from Leaderstats go to Filtering and then all other things and it would be hard to understand but you sticked to the point of the video thanks for the video subbed and joined discord.
So what's your level of coding right now? Can you share some projects? I just started and I want to see your progress.
@TVDeveloper whats your level of coding now?
Well i code sometimes
@strahii2075 but are u good at it
If you still reply I’m having a problem with this video I have the new Roblox menu and it won’t show me the leaderboard and I have no idea if anyone else can I’m really confused about what I should do
same
I made this, it should work with the current leaderboard :)!
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("IntValue")
leaderstats.Name = 'leaderstats'
leaderstats.Value = 0
local Points = Instance.new("IntValue")
Points.Name = 'Points'
Points.Value = 0
leaderstats.Parent = player
Points.Parent = leaderstats
end)
For me it worked.
Maybe press Tab?
Move the script into serverscript service, it worked for me (:
@@user-cp1fu7ef6g is right it worked for me too
To anyone who are looking though his tutorials: These are still useful even after 4 years! Which makes this tutorial the top. 100% recommend.
if u want it to have a delay so u can't click it infinity times in a second this is the script for you (I hope you understood the sentence lol)
local waiting = 0
script.Parent.ClickDetector.MouseClick:Connect(function(player)
if waiting == 0 then
waiting = 1
player.leaderstats.Points.Value += 1
wait(1)
waiting = 0
end
end)
Yep. Nice work.
ty, btw i feel like 0.2 seconds is the sweet spot when it comes to the wait part
noice man you and alvinblox collab boom best tutorial of the history of roblox studio
Alvinblox is shit
Hi Dev King! I love all ur videos, they are clear and easy to understand. But i have one question, what is the (function(player) mean? Does it mean it creates a function that accesses the players? Thanks!
Ya I had the same question.
I'm pretty sure it's an internal function that is precoded into Roblox. It pretty much allows you to access the players tab remotely (I could be wrong because I'm just learning).
@@thesnedd7219 Bingo! You are correct! Though, I am responding to this message a year later... So I'm guessing you probably know by now. But hopefully, this was helpful to someone else! 😀
@@naqiraza5579 It was thanks🙏
@@Nhancee Np!
Hey man! This tutorial is amazing!! Thanks for the help :D
wouldnt the varible leaderstats be out of scope on the other script because its in the function?
I know that’s what I was thinking
No because leaderstats is even a folder
when i tried to do the script that made it so the stats go up by one, it kept saying that "leaderstats" wasn't a member of player. And when I was in the testing screen, I went into m character and it showed the folder "leaderstats". And it was exactly how I spelled it in the script too. Could you help me figure out what to do. Please and Thank You. Plus you make awesome content, it helps me alot with learning how to script. Thank you.
Because roblox updated the leaderboards, its outdated :(
It should not be a problem, maybe write down your script here?
leaderstats shouldn't be parented to character, it should be parented to the player. that's your issue.
You are so easy to understand, some youtubersteach it like we already know it.
way underrated
I love your tutorials man ive been trying to find a tutorial for this for like 2 hours and finally i found one
What about how your points go up after you walk over a part??
then just make it part:Touched(thing) and detect if that thing is a character, if it is get the player from character and then u can change the leaderstats thing, plus add a debounce script else it will glitch and give a lot of points
I'm a beginner scripter and very bad at scripting so this is probably a really bad script but i got this to work(put this in the script of the part you want to walk over)
script.Parent.Touched:Connect(function(player)
if game.Players:GetPlayerFromCharacter(player.Parent) then
local PlayerPoints = game.Players:GetPlayerFromCharacter(player.Parent).leaderstats.Points
PlayerPoints.Value = PlayerPoints.Value + 1
end
end)
@@zye247 kinda glitchy though without the debounce
That is easiest , i need to get hang of the click though
@@amia3978 debounce?
Hey man i love your videos, slowly developing away been a few years now, doing youtube for a year now too. But thanks for all the help half the stuff i've learnt is you the other the API. Hopefully one day i'll be a solo dev on your shark tank
what did you even say
@@lukasmasar2973 ikr lol!
3:49 Never never name is "I'm the leader!"
you should do a livestream where you answer questions that we ask you about random scripting things, also videos are super helpful
he doesnt even upload anymore
did the same, the leaderboard just wont show up
Same idk why maybe bc this vid is a little bit old but he still explains things really good he is the only youtuber I could have understand anything from
@@dadonutmaker it did work for for me if you want to trouble shoot i suggest using a image to text converter with both of them and asking chatgpt what the difference between the two scripts are
Subbed, great video!
If anybody wanna access the player's character that's in workspace you gotta do :CharacterAdded() for example:
game.Players.PlayersAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local stats = Instance.new("Folder", char)
stats.Name = "leaderstats"
end)
it's useful
Btw isnt it "PlayerAdded" in the top line of code instead of "PlayersAdded"
it was way too difficult trying to use that event
Yes, but for any onlookers please don't put leaderstats in any players character. Also correct me if I'm wrong, we can also do Player.Character but just in case do .CharacterAdded(Character) because of any internet concerns.
@@BeatFlour Oh thanks for the tip
will there be a video on how to make the your stats in the leaderboard save, or should we jut watch a different tutorial on that?
does it work in 2024?
Nah
but how can we make it save when we leave?
local comment = "" i am watching this video after five years""
local thanks = ""and i have learned a lot form it thank you devking""
print(comment )
print(thanks)
local reply = "This comment is sick"
print(reply)
local Reply = Instance.new("Reply",Comment)
Reply.Name = ("i must join this")
6:49 my stamp
I learned Unity and now I'm learning Roblox thanks to you 👍🏿
same lol
would u suggest a channel where i can learn unity?
@@kiannooooo if you haven't already found one, i would recommend brackeys
this is so hard not to get bored of
but its worth it D:
to those who are having problems with the leader board here is the correct working script.
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”, player)
leaderstats.Name = “leaderstats”
local Points = Instance.new(“IntValue”, leaderstats)
Points.Name = “Points”
end)
Now it’s okay to replace the “Points” with another currency. If you type exactly how I typed it here you will be able to have it working.
Pagers Development
Instead of doing
local leaderstats = Instance.new(“Folder”),player)
leaderstats.Name = “leaderstats”
Do this:
local leaderstats = Instance.new(“Folder”)
leaderstats.Parent = player
leaderstats.Name = “leaderstats”
-[[Putting the parent of the item in another line makes your script way faster, it’s way better]]
This tutorial was great also I found a good way to learn how to script quickly by combining his tutorials in one script and not to look at any tutorials while making the script and see if you have improved and I did it and I was able to make it so you get multipliers if you have a certain amount of points and I was so happy when I actually made the code work!
I keep getting an error that says Points is not a valid member of Folder "My Username.leaderstats"
@@ComicleGaming same 😭
@@ComicleGaming I found the problem to mine, Value needs the capital V.
and you need to name the Points .Name, "Points" or whatever you called the variable.
@@ThawBerry thanks I'll see if it worked I kinda gave up on my project but I'll check if I scraped the code
@@ComicleGaming np
I didn't understand how you used "player"as parameter
How does roblox recognise that "player" is the actual player of the game and not like variable or parameter?
Magic :D
@@neokatwastaken I'm the founder of Roblox now.
You know how?
MAGIC!!!
@@shadowedlife5000 lol
In the Object browser. If you try to find the event. It's gonna be written like this fo an example :
Touched(Instance thatTouch)
Roblox will automaticly fill the parameter with the data described once you trigger the event. To get the paramater data, you use function :Connect(function("the parameter").
For example
Touched:Connect(function(hit)
So when something trigger the event by touching the referenced part. The paramater will be filled by the subject that touched it. Example if a part touched it, then it will br filled like this
Touched:Connect(function(part)
'Player' is part of the PlayerAdded function, like 'hit' is part of touched function.
before some lines of basic script was like super advanced script but now as i watch this, it makes alot of sense , and i watch 10 vids daily
REPLACE THE POINTSGIVER SCRIPT WITH:
script.Parent.MouseClick:Connect(function(player)
player:WaitForChild("leaderstats"):WaitForChild("Points").Value += 1
end)
W
why wait? how would they click if they didn't load yet?
@@ZombeeStar bruh. Thats why its wait. It waits for the leaderstats and the points and adds 1 to the value when the button is clicked
it says MouseClick is not a valid member of Part "Workspace.Part"
@@detcom9140 yeah here too
Guys I'm struggling on the 2nd part where you script
You can also write += 1
It's so easy and interesting, that I watched all the series in like 4 days and it was lite. Like I was playing some games and watching TH-cam and a little I wach then this tutorial, it's very easy, thank you❤
Death tracker script for obbies I made :)
game:GetService("Players").PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Deaths = Instance.new("IntValue",leaderstats)
Deaths.Name = "Deaths"
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
Deaths.Value = Deaths.Value + 1
end)
end)
end)
huh ?
wat is dat GetService stuff ?
btw thx for it, cool script
Hey @Alex that getservice stuff is when you're trying to call something like Replicated storage, or, startergui and stuff like that. Watch Dev kings video for further information on that if I want
Nice death tracker btw
Guys remember this is the old script and you shouldn't put Click detector anymore in the script but you should in the part
So it's script.Parent.MouseClick:Connect(function(player)
7:49
"they detect if you licked it"
-TheDevKing
He actually said "They Detect if you Clicked It"
@@hirenshah7828 ik it sounded like he said they detect if you licked it
the value doesnt show up as a leaderboard unless the folder is named leaderstats?
yes
yeah
i understood how to make a tycoon without wanting to. wow
bro istg these videos are awesome 3 years later
this does not work no more
you don't have to make a variable you can do it in the second wat that he said
script.Parent.ClickDetector.MouseClick:Connect(function(player)
player.leaderstats.points.Value = player.leaderstats.points.Value + 1
end)
it is still working
@@PlayFroge_gamertysm im gonna try
@@PlayFroge_gamertysm im gonna try
@@PlayFroge_gamer doesnt work anymore
So these values get saved in some database? What happens if the user logs off? Do them get saved?
th-cam.com/video/n1UpT2csAzo/w-d-xo.html
@@finnwydd Thank you very much :)
You learn to script from anyone else:gEt NoObeD
You learn to script from Dev:Legendary Hacker Man
lmao
I actually really enjoyed this video. After I learned how to make leaderboards, I sort of challenged myself to make a thing similar to cookie clicker, where you can spend a certain amount of points to buy a cursor and get it to automatically generate a certain amount of points after a certain amount of time.
how did you do that cooke clicker script, i just CANT get it to add clicks when an image ubtton is clicked on
@@r_odyy12 Sorry for the late response, but this is what I did:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local cursor = script.Parent
local playerpoints = player:WaitForChild("leaderstats").Points
function addclicks()
while true do
wait(3)
playerpoints.Value = playerpoints.Value + 10
end
end
cursor.Activated:Connect(function()
if playerpoints.Value >= 50 then
playerpoints.Value = playerpoints.Value - 50
addclicks()
elseif playerpoints.Value
@@pyrite7639 how do you learn all this when he didnt mention most of this
@@sepho942 you can do that if you learned everything from the series until now.
lmao im gonna make clicking simulator with this
god please no
@@pavul9890 Realized that is a worthless idea ngl and I'm a way more advanced developer so I wouldn't think of such medicore cash grab ideas like that.
how do you make it into a text button instead of a part
If you want a simplified way to do it, or without having to create 2 seperate scripts, it's:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder", player)
leaderstats.Name = "leaderstats"
local Points = Instance.new("IntValue", leaderstats)
Points.Name = "Clicks"
Points.Value = 0
script.Parent.ClickDetector.MouseClick:Connect(function()
Points.Value = Points.Value + 1
end)
end)
(make sure you put the script inside the part with the ClickDetector)
@Choco Latte No. Because of how Roblox works, you need to 'save' the data the script makes. I didn't do that. Instead, I improved on the script TheDevKing gave in the video to simplify it for others.
@Choco Lattepretty sure it would be in a seperate localscript because it happens to the client and not the server
im so happy that i almost finished the beginner series :D
How would you do it so the information (The player's stats) gets displayed in a custom leaderboard GUI?
You just add a gui ansd make so it checks the leaderstat value of the localplayer
TheDevKing already did a turorial on that
so go check it out bro that guy is a hero
lol
im making a sword fight game, how do you make it so every time you kill a player it will give a point?
you should search that
@@blexfrouts3222 ok
dont mind me, im just continuing where i left off 10:31
If anybody is struggling to get this to work in a script longer than his, try to put this at the top of the script, especially before any wait commands, so that the function is ready before the first player loads. This mistake cost me 30 minutes of debugging time
I think this is not working in 2024
You have to put “players” instead of “player” in 2024
Hey devking i think this version of the studio is outdated can you please make a new tutorial about leaderstats?
I have a question?
After completing the playlist we have to watch the Introduction to Guis or..
Tools???
Please answer my question 🙃
its your choice
Tools
Finish advanced first then gui
i know he was gonna say leader-hotdog
should i be worried if i cant replicate this off memory when i need it or would i just need to understand it for now? same goes for the other beginner guides youve got
As long as you understand the key parts of the video, like how you create leaderstats, you should be good. You can always rewatch the tutorials if you forget them. Scripting is also 75% experimental so combining things you've already learnt with the things you have just learnt will for sure be a good way to get you not forgetting short term info
@@thehexofficial yeah ive made a studio where i just slap everything he teaches and add it into this one game type of thing. thanks for the response
@@WanoFax 👍
Finished the Tutorial, here's my finished Product ( I modified it for people to use)
I edited it to make it better
local Gold = Instance.new("Part",workspace)
Gold.Name = "Gold"
Gold.Position = Vector3.new(-44.245, 18.088, -4.809)
Instance.new("ClickDetector", Gold)
Gold.Color = Color3.fromRGB(255, 170, 0)
Gold.Size = Vector3.new(5,5,5)
Gold.Anchored = true
local Sparkles = Instance.new("Sparkles",Gold)
Sparkles.SparkleColor = Color3.fromRGB(115, 0, 173)
local function Statistics()
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local points = Instance.new("IntValue",leaderstats)
points.Name = "EXP"
points.Value = 0
local Level = Instance.new("IntValue", leaderstats)
Level.Name = "Level"
Level.Value = 0
game.Workspace.Gold.ClickDetector.MouseClick:Connect(function(player)
wait()
points.Value = points.Value + 10
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
while true do
wait()
if Level.Value == 100 then
points.Value = 100000000000
end
end
end)
end)
end
Statistics()
You can just create a script and paste it in there.
This defeats the purpose of the tutorial.
@@chromeexterior8141 lol
thanks
game.Workspace.Gold.ClickDetector.MouseClick:Connect(function(player)
wait()
points.Value = points.Value + 10
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
if points.Value == 100 then
Level.Value = Level.Value + 1
points.Value = 0
end
Why r u repeating it?
so the folder is in the properties of the player but the leaderboard doesn't show up in the top right. is this just because of the new layout of roblox?
Nope its an error it should show up in the top right but the layout is a little different.
I'm making a homestore, is there a way to make the number rod clothes bought go up everytime you buy it instead of click it?
Im pretty sure you could use a if statement and check if the person has bought the id of the shirt/pant. If so, then add 1 to the value of the leaderstat you want. If they havent bought it, then do nothing and add 0.
this is probably the best tutorial in the begginer tutorials.
Hey! I have a question. How does the game know what the "player" parameter is? in pointsGiver and in leaderstats?
Yo bro I was thinking about the same thing. Do you already know the answer?
@OK-kh8pl Yes, it is because for certain events there are built-in parameters. Player added returns the player who was added, mouse click returns the player who clicked.
BRO the dev king ik your videos are kinda old BUT HOLLY YOU HAVE TO BE THE BEST PERSON TO EXPLAIN CODE IN A WAY I UNDERSTAND I started code 2 days ago and watched your videos and now I know so much more
what if I want to do something else inside of this script? How would I so that if I can only use one variable inside of the function?
Would you have to create a script to save the player's progress, or is that automatically done?
You need a script I have not learned how to do it tho
@@Corvus_the_wyvern me neither, but I found two datastore links if you want to check them out. I haven't watched them yet, but here you go: th-cam.com/video/DkYupSBUpes/w-d-xo.html th-cam.com/video/hBfMfB0BwGA/w-d-xo.html
@@theartisticfox9050 go watch thedevking advanced coding guide Datastores
@@Corvus_the_wyvern go watch thedevking advanced coding tutorial Datastores
Thank you so much, you really help me on my journey!!
It's funny. I wanted to make 2 intvaleus for 2 different leaderstats values but the second one always replaced the first one. Is this a new roblox update or something?
i am beginner and thankyou for the video. i am going to ask does that means every single time a player joined into the game their point will be resetted into 5? if not so where is their last point stored?
20:57:40.180 - Workspace.Part.PointsGiver:1: attempt to call a userdata value
what does this mean?
I tried it but it keep saying click detecter is not a member of click detector
for short, instead of doing = + , you can instead do; += (Points += 1 for example)
wow ty
Kainen Watson yw 🙃
roblox leaderstats has been changed now, can u make another tutorial on leaderstas plz
I don't think they changed? Well they did for like a day but its the same now :)
@@TheDevKing ok
@@TheDevKing But now they changed :O
Guys the leaderstats work
Thanks dev king. I feel amazed.
wow sound for once xD, and 4th
Edit: Thanks for the heart!
lol I promise every vid will now have sound all of them have been fixed btw