#JumpHeight datastore
5 messages · Page 1 of 1 (latest)
t = {
JumpHeight= humanoid.JumpHeight
}
--save t to datastore
--get t
Humanoid.JumpHeight = t.JumpHeight
local dataStoreService = game:GetService("DataStoreService")
local ds = dataStoreService:GetDataStore("DataStoreTest")
local RebirthEvent = game.ReplicatedStorage:WaitForChild("RebirthEvent")
game.Players.PlayerAdded:Connect(function(Player)
local leaderstats = Instance.new("Folder", Player)
leaderstats.Name = "leaderstats"
local jumpPower = Instance.new("NumberValue", leaderstats)
jumpPower.Name = "Jump"
jumpPower.Value = 0
local wins = Instance.new("IntValue", leaderstats)
wins.Name = "Wins"
wins.Value = 0
local Rebirths = Instance.new("IntValue", leaderstats)
Rebirths.Name = "Rebirths"
Rebirths.Value = 0
local Multiplier = Instance.new("IntValue", Player)
Multiplier.Name = "Multiplier"
local WinsData, RebirthsData, PointsData, MultiplierData
local success, errormessage = pcall(function()
WinsData = ds:GetAsync("Wins-"..Player.UserId)
RebirthsData = ds:GetAsync("Rebirths-"..Player.UserId)
PointsData = ds:GetAsync("Jump-"..Player.UserId)
MultiplierData = ds:GetAsync("Multiplier-"..Player.UserId)
end)
if success then
wins.Value = WinsData
Rebirths.Value = RebirthsData
jumpPower.Value = PointsData
Multiplier.Value = MultiplierData
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
local success, errormessage = pcall(function()
ds:SetAsync("Wins-"..plr.UserId, plr.leaderstats.Wins.Value)
ds:SetAsync("Rebirths-"..plr.UserId, plr.leaderstats.Rebirths.Value)
ds:SetAsync("Jump-"..plr.UserId, plr.leaderstats.Jump.Value)
ds:SetAsync("Multiplier-"..plr.UserId, plr.Multiplier.Value)
end)
end)
where do i add