#somebody mind helping me with a datastore script?
53 messages · Page 1 of 1 (latest)
Actually, you can just do
local DataStoreService = game:GetService("DataStoreService")
local --ur data name-- = DataStoreService:GetDataStore("--ur data name--)
"game.Players.PlayerAdded:Connect(function(Player))
local leaderstat = Instance.new("Folder")
leaderstats.Name = "leaderstat"
leaderstat.Parent = Player
local Cash = Instance.new("Intvalue")
Cash.Name = "Cash"
Cash.Parent = leaderstat
local data
local success, errormessage = pcall(function()
data = --ur data name--:GetAsync(player.UserID.."Cash") --so the game can load the data--
end)
if success then
Cash.Value = data
else
warn(errormessage)
end
end)
and you do the same thing when a player leaves but with SetAsync
( game.Players.PlayerRemoving)
and --ur data name--:SetAsync(player.UserID.."Cash",player.leaderstats.Cash.Value)
hope that helped
GetAsync is to get the data, and SetAsync is to save the data, so do it for the two values that u want, and replace the --ur data name-- by the data name that u want
didn't work too
** You are now Level 1! **
@feral bloom try your own datastore script with those 2 values, give yourself some cash and miles, rejoin and see if it works for you, if it does, I'd like to know the script.
because I'm doing everything right but it still doesn't work
okay two seconds
okay letme try
i think iv made a mistake, leave me a litle bit of time , im trying to fix it
maybe you haven't and you're encountering the same error 🤔
im looking for the error, im trying to do another method
got it
2 sec (letme re do the script)
that would be such a huge help dude 🫠
my brain was literally melting when I was going through all those methods
i think its done
** You are now Level 4! **
cool
** You are now Level 2! **
great
and i think iv done a thing that is working lol
lol
letme try to leave and rejoin to see if its saving
okay so that's weird
the thing is saving
but the miles got the same value as the coins
letme try to fix this rq
I'm starting to think that roblox changed something for datastoring
because it feels way harder than before the big studio update
ok bro i'm sorry i don't lnow, iv done the script, it works for one value but the other value get the same value as the first each times i join
sorry, i hope someone better than me in datastore will find this
ok just send me the code and I'll try to figure it out myself with my friend that can code too but only a little better than me
ok
iv tryed to do only one script but that wasnt working at all
have a nice day
#RobloxStudioTutorial #DataStore
In this video I show you how to you can store multiple leaderstat values in you Roblox Studio games! Saving data makes your games more enjoyable and encourages players to return to continue their progress! This is a continuation of my other data store video that covered how to store single values.
Link to Code
...
this might have fixed the problem