Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a script to save my JumpPower?

Hello, I’ve been having some difficulty as I find understanding datastores quite difficult.

I would really appreciate if someone could help me, I am trying to make a script which whenever you leave the game it saves you JumpPower and it saves the stats from my leaderboard. I’d appreciate if someone could help me create this script.

Thank you.

1 answer

✓ Accepted answer

use data store, get async and set async to load and save data

local d = game:GetService("DataStoreService"):GetDataStore()
game.Players.PlayerAdded:Connect(function(p)
	if d:GetAsync(p.userId) ~= nil then
		p.Character:WaitForChild("Humanoid").JumpPower = d:GetAsync(p.UserId)[1]
	end
end)
game.Players.PlayerRemoving:Connect(function(p)
	d:SetAsync(p.UserId,p.Character.Humanoid.JumpPower)
end)

use player added and removing to get the player, make sure this is a server script in workspace or something k enjoy ur script, also remember to add a check to see if the data already exists. Click accept answer on this question if its correct

2 comments

0

Thank you

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.