You missed a comma, it should be datastore:SetAsync("id_"..plr.userId, {plr.leaderstats.Money.Value}) (this caused a considerable amount of issue, also you should show the script for increasing the leaderstat scores, and at least put the code in the description ) 😐
Thanks a lot bro ! It worked ! Just a tip for people where it don't work: "You missed a comma, it should be datastore:SetAsync("id_"..plr.userId, {plr.leaderstats.Money.Value})"
@@somebody_2837 No one cares, its scripting. Tons of people write code the same, and he's just sharing it to more people that have no idea who gamerm8 is.
You are one of the few people who make good tutorials. All of the other videos require you to copy and paste things and with this video, I'm actually learning!!!
I typed everything exactly the same.. I also enabled the services, but it's not working. I spent 5 hrs looking for the mistake but theres none. THE script is the one thats not working
I've got a HUGE problem. Whenever i play the script (not on studio) i rejoined and got nothing. When i tested it on studio i got a error saying "Expected identifier when parsing expression, got then" please someone help me.
I can help you on this one! A leaderstats script like this should resolve your problem: game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player) leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with) If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again... "local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with)" Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand. I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
I can help you on this one! A script like this should resolve your problem: game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player) leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with) If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again... "local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with)" Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand. I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
@@nogtohall4328 Hello, you actually do not need any local script for a datastore or leaderstats script. This is because of the regular script and its given texts like "local" inside of its script indicating that it can be global to the other local people. I hoped this educated you in some form. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
It went well. I appreciate it. However, the block script is debouncing and I have spent 3 hours trying to eliminate the debounce and have not been able to resolve it. The cooldown does not work. There is a slight delay for those seconds. Is there any way to fix this problem? Also, if you don't mind me asking, what is the code that solved the debounce? I am Japanese and use a translator. Sorry for my poor English. From Japan🇯🇵❣️.
I'm making an obby right now and I already have a leaderstats for stages, and I only want to add one new leaderstats for a new currency in it but I can't figure it out can someone help me please?
Here is a script that if you update the game you keep you data local datastore = game:GetService("DataStoreService"):GetDataStore("SaveData") game.Players.PlayerAdded:Connect(function(plr) wait(1)
local plrid = "id_"..plr.UserId local save1 = plr.leaderstats.Coins local save2 = plr.leaderstats.Level
local GetSaved = datastore:GetAsync(plrid) if GetSaved then save1.Value = GetSaved[1] save2.Value = GetSaved[2] else local NumberForSaving = {save1.Value, save2.Value} datastore:SetAsync(plrid, NumberForSaving) end end) game.Players.PlayerRemoving:Connect(function(plr) local plrid = "id_"..plr.UserId local NumberForSaving = {plr.leaderstats.Coins.Value, plr.leaderstats.Level.Value} datastore:SetAsync(plrid, NumberForSaving) end)
I'm having trouble with the leader stats part so basically I'm trying to make a Shop GUI and whenever you buy something the "taco" value (the currency for my game) subtracts the amount you bought it for everything goes smoothly expect for when the taco value should go down it doesn't here is my script ---> game.ReplicatedStorage.ToolEvent.BlackChancla.OnServerEvent:Connect(function(player) if player.leaderstats.Tacos.value >= 300 then game.ServerStorage.BlackChancla:Clone().Parent = player.Backpack player.leaderstats.Tacos.value -= 300 end end) can you lmk where i am going wrong in regards to the subtraction of the taco value pls? thank u so much
at player.leaderstats.Tacos.value -= 300 it should be player.leaderstats.Tacos.Value = player.leaderstats.Tacos.Value - 300 plus the value should be uppercase V
I can help you on this one! A script like this should resolve your problem: game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player) leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with) If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again... "local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with)" Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand. I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
Add a Clickdetector to a part then add a script.The script is: script.Parent.Clickdetector.Mouseclick:connect(function(player) player:waitforchild(“leaderstats”):waitforchild(“money”).Value +=1
I am having trouble with changing the value of how long it should wait or how much money you get. It works just fine when I copy and paste your script but when change it to my liking it does not work anymore could you PLEASE help me out with this. thanks
Hey, I have a HUGE problem where when I test my game in studio both of the leaderstats come up, but then when I test it in the game (not on studio) it only shows one of the leaderstats. Can someone help me on this? I gave up and I don't know what to do!
I can help you on this one! A script like this should resolve your problem: game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player) leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with) If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again... "local (enter the name that you are using) = Instance.new("NumberValue", leaderstats) (enter the name that you are using).Name = "(enter the name that you are using)" (enter the name that you are using).Value = (choose any number that a new player will begin with)" Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand. I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
Put this script inside of a part you want to make money go up: script.Parent.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) task.wait(1) --replace 1 with how much seconds you want it to cooldown player.leaderstats.Money.Value += 150 --change 150 to the value you want player.leaderstats.Level.Value += 25 --change 25 to the value you want end end)
Well, i have tried everything and nothing works to me :((( i have spent over 5 hours on finding the autosave and something didnt help for my clicker game
leaderstats script:script.Parent.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) task.wait(1) --replace 1 with how much seconds you want it to cooldown player.leaderstats.Money.Value += 150 --change 150 to the value you want player.leaderstats.Level.Value += 25 --change 25 to the value you want end end)
Well thats what I have too and to make sure the gui value will save all you have to do is make sure the gui that shows the amount of clicks is going off of the leaderstats.
can you make a tutorial on how to get +1 wins on the leaderboard when you win a race in the Racing template in roblox studio, that would really help me out! also i love your videos
hey guys, if you want, let's say, a stat ui to detect when you make changes to the leaderstat, let me know! i have the perfect script for it :D (created by me cause boredom)
first script game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local cash = Instance.new ("IntValue") --this all makes the cash leaderstat cash.Name = "Cash" cash.Parent = leaderstats
local rp = Instance.new ("IntValue")--this all makes the RP leaderstat rp.Name = "RP" rp.Parent = leaderstats end)
This is an older tutorial, so the method shown here may or may not work very well anymore. If you still have troubles, you can try the updated version of this tutorial: th-cam.com/video/xoui5hR_8IE/w-d-xo.html
He put it in the description but I got it for you! :) Here is the script to put inside of a wanted part to give you points: script.Parent.Touched:Connect(function(hit) if hit and hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent) task.wait(1) --replace 1 with how much seconds you want it to cooldown player.leaderstats.Money.Value += 150 --change 150 to the value you want player.leaderstats.Level.Value += 25 --change 25 to the value you want end end)
Modify the script as you'd like: local datastore = game:GetService("DataStoreService"):GetDataStore("SaveData") game.Players.PlayerAdded:Connect(function(plr) wait() local plrid = "id_"..plr.UserId plr:WaitForChild("leaderstats") -- Wait until leaderstats are initialized local save1 = plr.leaderstats.Wins local save2 = plr.leaderstats.Kills local save3 = plr.leaderstats.Deaths local GetSaved = datastore:GetAsync(plrid) if GetSaved then save1.Value = GetSaved[1] save2.Value = GetSaved[2] save3.Value = GetSaved[3] else local NumberForSaving = {save1.Value, save2.Value, save3.Value} datastore:SetAsync(plrid, NumberForSaving) end end) game.Players.PlayerRemoving:Connect(function(plr) local plrid = "id_"..plr.UserId datastore:SetAsync(plrid, {plr.leaderstats.Wins.Value, plr.leaderstats.Kills.Value, plr.leaderstats.Deaths.Value}) end)
You missed a comma, it should be
datastore:SetAsync("id_"..plr.userId, {plr.leaderstats.Money.Value})
(this caused a considerable amount of issue, also you should show the script for increasing the leaderstat scores, and at least put the code in the description )
😐
Thanks you saved my life
thanks for saying this it wasn't working and i didnt know how to fix it
which line?
now i dont have to write that line 😅
What line?
Remember for anyone whos planning to use this script, its not userId, now its UserId with a capital at the start.
thank you
i love you
@@ralph7605 AYO!?!
Thanks a lot bro ! It worked ! Just a tip for people where it don't work:
"You missed a comma, it should be
datastore:SetAsync("id_"..plr.userId, {plr.leaderstats.Money.Value})"
But where???
@@Drauner learn how to read
@@GoldGamerv-69 rude but it is easy
Bro thanks so much, have been trying this for 2 months. Only yours worked!
Glad it worked for you!
This is the least complicated tutorial i could find
😃
This saved my game from having a hard time to save data, thank you for the script.
Great Video!!!
It says that line 14 has an error with casting an value to object, i've checked it 5 times.
Same and the internet is no help at all
same for me.
@@ripyourshirt This is why you should learn coding by yourself
thank you. now i can actually save more than just my leaderstats with this with a little editing. Here is a like: 👍
u deserve more subs, that was really helpful
He copied GamerM8's scripts, he doesn't deserve more subs
@@somebody_2837 No one cares, its scripting. Tons of people write code the same, and he's just sharing it to more people that have no idea who gamerm8 is.
@@dwbgames6011 It still doesn't change the fact that he didn't put any effort into this, and instead copied from another person.
@@somebody_2837 its a popular way of scripting this, its nothing new
@@dwbgames6011 No it isn't, who even told you that
You are one of the few people who make good tutorials. All of the other videos require you to copy and paste things and with this video, I'm actually learning!!!
YO THATS MY GD ICON AND YOUR NAME IS THE NAME OF MY FRIENDS CAT
@@nualasagoofyahhcat That's pretty cool lol
I've got a question how do you make the money go higher by standing on the block? what is the script?
In the description!
@@onfirerobloxscripting the script didnt work
instead of making it like a click event make it a touch event
W VIDEO AGAIN
u got some errors that u didnt acknowledge at the end
OMG IT WORKED THANK YOU SO AND SO MUCH! :D
Hopefully you found the tutorial helpful!
👍
epic
what is the script for the brick?
Can you explain the scripts because I am not learning anything
put the first script for the leaderstats itself in the description
Would be worth it remaking this, as people find the data store script only works half the time
I typed everything exactly the same.. I also enabled the services, but it's not working. I spent 5 hrs looking for the mistake but theres none. THE script is the one thats not working
Lemme know if you eventually found anything...
I've got a HUGE problem. Whenever i play the script (not on studio) i rejoined and got nothing. When i tested it on studio i got a error saying "Expected identifier when parsing expression, got then"
please someone help me.
i got the same... its outdated
@@GlitchedUser999 Refer To Pinned Comment
Means Ur Missing a ‘)’
I can help you on this one! A leaderstats script like this should resolve your problem:
game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)
If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again...
"local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)"
Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand.
I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
@@brandonwong7284 or put a extra ( or )
Whenever I tried to make a script it doesn’t display data for other people. Does this display data or no?
i had the problem even without a datastore. im not sure if this is a global issue, or its just a simple little fix 🤷♂️
It's a local script then
@@theogray9218 It's a local script then
I can help you on this one! A script like this should resolve your problem:
game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)
If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again...
"local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)"
Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand.
I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
@@nogtohall4328 Hello, you actually do not need any local script for a datastore or leaderstats script. This is because of the regular script and its given texts like "local" inside of its script indicating that it can be global to the other local people.
I hoped this educated you in some form. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
It does work but in my game you can but rebirths but they don't save only if I pick them up like a coin how can I fix this?
thank u soo much this is the only tutorial I could find that actually worked lolol
It went well. I appreciate it. However, the block script is debouncing and I have spent 3 hours trying to eliminate the debounce and have not been able to resolve it. The cooldown does not work. There is a slight delay for those seconds.
Is there any way to fix this problem?
Also, if you don't mind me asking, what is the code that solved the debounce?
I am Japanese and use a translator.
Sorry for my poor English.
From Japan🇯🇵❣️.
Your English is good
あなたの英語は上手です(Google翻訳を使用すると、これが悪い場合は申し訳ありません)
just change the number in the wait function 😐
@@micamaster100 I also am having the same problem he is having and that does not work for me
@@AlamRBLX me too but did you solve it now? if yes please tell me how
I think i fixed it i just froget how sorry@@hshdjdjsjjsjs6075
I'm making an obby right now and I already have a leaderstats for stages, and I only want to add one new leaderstats for a new currency in it but I can't figure it out can someone help me please?
dude he made 2 leaderstats in the video with different currency
Here is a script that if you update the game you keep you data
local datastore = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait(1)
local plrid = "id_"..plr.UserId
local save1 = plr.leaderstats.Coins
local save2 = plr.leaderstats.Level
local GetSaved = datastore:GetAsync(plrid)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
else
local NumberForSaving = {save1.Value, save2.Value}
datastore:SetAsync(plrid, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local plrid = "id_"..plr.UserId
local NumberForSaving = {plr.leaderstats.Coins.Value, plr.leaderstats.Level.Value}
datastore:SetAsync(plrid, NumberForSaving)
end)
thank you
I'm having trouble with the leader stats part
so basically I'm trying to make a Shop GUI and whenever you buy something the "taco" value (the currency for my game) subtracts the amount you bought it for
everything goes smoothly expect for when the taco value should go down it doesn't
here is my script --->
game.ReplicatedStorage.ToolEvent.BlackChancla.OnServerEvent:Connect(function(player)
if player.leaderstats.Tacos.value >= 300 then
game.ServerStorage.BlackChancla:Clone().Parent = player.Backpack
player.leaderstats.Tacos.value -= 300
end
end)
can you lmk where i am going wrong in regards to the subtraction of the taco value pls? thank u so much
at player.leaderstats.Tacos.value -= 300 it should be player.leaderstats.Tacos.Value = player.leaderstats.Tacos.Value - 300
plus the value should be uppercase V
My leaderstats don’t show on the screen in studio or in-game. I’ve enabled API Services and HTTP Requests
If you still need help just send the script and I'll help you out :)
I can help you on this one! A script like this should resolve your problem:
game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)
If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again...
"local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)"
Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand.
I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
Could you reply with a script where when you press a button with a Proximity prompt it will + value?
Add a Clickdetector to a part then add a script.The script is: script.Parent.Clickdetector.Mouseclick:connect(function(player)
player:waitforchild(“leaderstats”):waitforchild(“money”).Value +=1
local PP = script.Parent
PP.RequiresLineOfSight = false
PP.Triggered:Connect(function(player)
player.leaderstats.STAT.Value = player.leaderstats.STAT.Value +AMMOUNT
end)
something like that
@@zellpoxioPP
hahaha so funny @@Win2User
worth a sub :D
I am having trouble with changing the value of how long it should wait or how much money you get. It works just fine when I copy and paste your script but when change it to my liking it does not work anymore could you PLEASE help me out with this. thanks
I have a question, can you make a proximityprompt give add cash to the leaderstats
go into console, server type game.players.username.leaderstats.value = amont you want to give
Hey, I have a HUGE problem where when I test my game in studio both of the leaderstats come up, but then when I test it in the game (not on studio) it only shows one of the leaderstats. Can someone help me on this? I gave up and I don't know what to do!
Make sure your game has access to "API" Server
@@Scryptings I've fixed this already.
I can help you on this one! A script like this should resolve your problem:
game.Players.PlayerAdded:Connect(function(Player)
--- Leaderstats ---
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)
If you feel that you need to keep making more leaderstats for a game of yours just do the same lines below the first set of lines like this once again...
"local (enter the name that you are using) = Instance.new("NumberValue", leaderstats)
(enter the name that you are using).Name = "(enter the name that you are using)"
(enter the name that you are using).Value = (choose any number that a new player will begin with)"
Any occasional text like "(end),end), or end)" at the bottom of your scripts may be needed in result of an issue although they may already be put in place if you type out the script(s) that are shown by hand.
I hoped this helped you. I plan to become a developer on TH-cam who teaches lots of people scripting and more.
but how can you create that brick that gives you levels and money?
You can use this tutorial :) th-cam.com/video/94YLzh8leuo/w-d-xo.html
the "weird brackets" are called curly brackets fyi
I got an error that said ”Seconds Is not a valid member of ”Players.OfficialVerifiedDev.leaderstats”. I hate this issue please help me!”
If I decide to change the name of my level or money, should it still be level or money in between the quotation marks?
dataStore:SetAsync("id_"..plr.userId{plr.leaderstats.Cash.Value, plr.leaderstats.RP.Value})
I already have a leaderstat with minutes so the other one u did here wont show up, is there any way for me to fix it?
i get a :
23:33:03.704 Unable to cast value to Object - Server - datastore:14
im testing it on roblox studio why wont it show the leaderstats and how to add countdown after player gets score/money
how do you make it so it only gives you the leaderstat once before it doesnt give u more anymore
bro can you please tell me how you made the brick i want to make a brick that when i touch it it gives some leaderstats
he isn't gonna reply :( i need help with that too
@@Zero9xi i already firgured it out the same day lol
oh yea i saw in description
How did you make the part that makes the money go up 8:64
Put this script inside of a part you want to make money go up:
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
task.wait(1) --replace 1 with how much seconds you want it to cooldown
player.leaderstats.Money.Value += 150 --change 150 to the value you want
player.leaderstats.Level.Value += 25 --change 25 to the value you want
end
end)
forever thanks dude, god bless you and thanks for sharing
Still forever😂😂😂
Well, i have tried everything and nothing works to me :((( i have spent over 5 hours on finding the autosave and something didnt help for my clicker game
Not works for me too.
Have you enabled API services and HTTP request? In securities.
@@WhiteCircle63 Yes i have tried everything but its still not working
i've spent 4 days
Felt that
@@Sapharious_X Yeah, i am fucking still trying to find it
didnt work at all thank you soooo sooo sooo sooo much :))))))
why does google images show this video as a kpop loona meme?
leaderstats script:script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
task.wait(1) --replace 1 with how much seconds you want it to cooldown
player.leaderstats.Money.Value += 150 --change 150 to the value you want
player.leaderstats.Level.Value += 25 --change 25 to the value you want
end
end)
wow thanks it works, btw, can I ask, why in the :GetAsync from player added function has two :GetAsync?
tysm but for some reason my 1st leaderstat is not saving
how would i do this for speed i want to make a game that has speed in it but idk how to do that
I cant save my settings cuz there is a error plis respond i need help with it
I LOVE YOU SO MUCH
can we add another value just by copying the int value ?
i have a clicker gui and it has a value on it. is there any way to make it so the value counter will save?
Well thats what I have too and to make sure the gui value will save all you have to do is make sure the gui that shows the amount of clicks is going off of the leaderstats.
how do i add debounce ?? i dont want to delay it but i want a cooldown
Every Thing Worked Fine But I Am Trying To Make A Obby Checkpoint . So I only want to add 1 every checkpoint touched . Please Help
can you make a tutorial on how to get +1 wins on the leaderboard when you win a race in the Racing template in roblox studio, that would really help me out! also i love your videos
Tysm man!
Thank you so much! This tutorial helped a lot!
hello majestic! im a fan!
@@Pleds. this was quite a while ago lol...
Sure was
@@MajesticUC yes lol i just realised
Thank you soo much for this
I copied your script exactly but the "level" doesnt show in the leaderstats, and it doesnt save
just to remind you if you are confused, these are parentheses: (), these are brackets: [], these are curly braces: {}
its working but i need help i want to make if player press button get some money and save it now i cant save
Hello, what's the name of the second music, i liked.
what if I don't want a cooldown? I'm making an obby so that's why I'm asking
was this tutorial copied? because i just saw another video with the same code
can i make it so it doesn't have datastore? my game is about exploration and it doesn't require datastore
This tutorial should give you just the leaderstats: th-cam.com/video/Z3FQm_herbA/w-d-xo.html
7:30 (timestamp)
It works in roblox studion when I test but when I join the normal Roblox Game it doesnt work can someone help?
How do i change it that way so its an actual cooldown and not a delay??
please comment/provide a pastebin link for the scripts
the reason why he doesnt have pastebin links and etc is because the main part of typing it in manually is learning the script
4:46
(Where I left off)
hey guys, if you want, let's say, a stat ui to detect when you make changes to the leaderstat, let me know! i have the perfect script for it :D (created by me cause boredom)
also works with this datastore
Also, when i touch that part it gives me more than 1 level, i replaced 25 from line 6
How do u make it so money is added every 30 minutes?
can u make it where the part gets deleted after a certain amount of time?
You can add a script into a part and write this:
task.wait(30) --number in here represents seconds
script.Parent:Destroy() --Destroys the part
i have an error:
ServerScriptService.Datastore:19: attempt to call a number value
look at the pinned comment, maybe that will help. i had the same error, now i dont get an error, but it doesnt save
@@theogray9218 same
go to the dev forum
Shit not working, datastore isn't working, leaderstats doesent show on the leaderboard
first script
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local cash = Instance.new ("IntValue") --this all makes the cash leaderstat
cash.Name = "Cash"
cash.Parent = leaderstats
local rp = Instance.new ("IntValue")--this all makes the RP leaderstat
rp.Name = "RP"
rp.Parent = leaderstats
end)
Tysm bro
life saver !!
Thank you!
how do I destroy the part after it is touched and the value is added
You can add this inside the touched function:
script.Parent:Destroy()
@@onfirerobloxscripting thank you for the help
THANK YOU IS WORK!!!!!
it only works for 3 stats not more can u do a script for all stats?
just add more, it should be simple
does this save even if the game is shutdown or the player crashed?
no
How do you make it so this works in 2 games like aimblox
also if you want to start with a value do "Money.Value = 100" under your stat
my 2nd thing wont work D:
can you make a video how to save gui
i get an unable t cast value to object error on line 14 of the datastore script, anyone know y
This is an older tutorial, so the method shown here may or may not work very well anymore. If you still have troubles, you can try the updated version of this tutorial: th-cam.com/video/xoui5hR_8IE/w-d-xo.html
hello can u make a video for no datasave for vip servers ?
What is your font!!
I get breakpoints at the beginning of the data store script :/.
someone can explain what is remote servers?
A remote event basicly the same as a remote server is basicly a other way to do things with out being able to hack into the server and get 999 cash.
How do you make it so that if you get enough stuff you get a badge?
what is the script for the brick?
He put it in the description but I got it for you! :)
Here is the script to put inside of a wanted part to give you points:
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
task.wait(1) --replace 1 with how much seconds you want it to cooldown
player.leaderstats.Money.Value += 150 --change 150 to the value you want
player.leaderstats.Level.Value += 25 --change 25 to the value you want
end
end)
@@c.o1.e. thx
@@c.o1.e. Didnt need it anymore, but thx
@@frogybot Nice :)
Bro I spend over an hour doing this dont lie bro
Modify the script as you'd like:
local datastore = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrid = "id_"..plr.UserId
plr:WaitForChild("leaderstats") -- Wait until leaderstats are initialized
local save1 = plr.leaderstats.Wins
local save2 = plr.leaderstats.Kills
local save3 = plr.leaderstats.Deaths
local GetSaved = datastore:GetAsync(plrid)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
save3.Value = GetSaved[3]
else
local NumberForSaving = {save1.Value, save2.Value, save3.Value}
datastore:SetAsync(plrid, NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local plrid = "id_"..plr.UserId
datastore:SetAsync(plrid, {plr.leaderstats.Wins.Value, plr.leaderstats.Kills.Value, plr.leaderstats.Deaths.Value})
end)
Please make some kind of speed script, this worked for me, and I can’t find any other good tutorials!!!
👍😁 Nice