#yo guys i need help with a script for saving leaderstats when the player leaves
1 messages · Page 1 of 1 (latest)
k
ty
so
Datastore script:local dataStore = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(player)
wait()
local playerid = "id_"..player.UserId
local save1 = player.leaderstats.Footballs
local save2 = player.leaderstats.Rebirths
local save3 = player.leaderstats.Gems
local GetSaved = dataStore:GetAsync(playerid)
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:GetAsync(playerid,NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
dataStore:SetAsync("id_"..player.UserId, {player.leaderstats.Footballs.Value, player.leaderstats.Rebirths.Value, player.leaderstats.Gems.Value})
game:BindToClose()
end)
@waxen locust
?
does it have something to do with my click button script?
cuz it doesnt work
while wait() do
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local footballs = leaderstats:WaitForChild("Footballs")
script.Parent.Text = "Footballs: "..footballs.Value
end
@waxen locust
ye doesnt look like you looked up the function in the docs
huh?
im new to scripting
so i dont rlly understand
my friend kinda helped me
@waxen locust
maybe ask your friend
not sure what you're expecting by pinging me over and over, if you dont know how to script then there isn't much i can do to help you short of simply giving you working code, but this is scripting-help and not free-scripts. have you tried learning how to script? https://create.roblox.com/docs/tutorials/fundamentals/coding-1/coding-fundamentals
alr chill
