another error :
change the HeartBeat to “Heartbeat”
sorry i scripted this in here so im kinda dum
noooooo ok…
game[“Run Service”].Heartbeat:Connect(function()
local plr = game.Players:GetPlayerFromCharacter(script.Parent)
if plr then
if plr.walkspeed then
plr.walkspeed.Value = script.Parent:FindFirstChild(“Humanoid”).WalkSpeed
end
end
end)
It doesnt give a error now but where does it store the walkspeed?
just wait and ill just write the serverscript aswell in roblox studio
ok, thank you for youre help!
Np…
local dataStore = game:GetService(“DataStoreService”):GetDataStore(“TestVersion1”)
local speedData = game:GetService(“DataStoreService”):GetDataStore(“whateveruwanthere”)
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrid = “id_”…plr.UserId
local save1 = plr.leaderstats.Stage
local save2 = plr.leaderstats.Wins
local data
local new = Instance.new(“IntValue”,plr)
new.Name = “walkspeed”
pcall(function()
data = speedData:GetAsync(plr.UserId)
end)
if data ~= nil then
new.Value = data
end
local GetSaved = dataStore:GetAsync(plrid)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2]
else
local NumberForSaving = {save1.Value,save2.Value}
dataStore:GetAsync(plrid,NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
dataStore:SetAsync(“id_”…plr.UserId, {plr.leaderstats.Stage.Value,plr.leaderstats.Wins.Value})
speedData:SetAsync(plr.UserId,plr.walkspeed.Value)
print(“Saved data”)
end)
this is the server script
replace it with this
and this is the startercharscript
game[“Run Service”].Heartbeat:Connect(function()
local plr = game.Players:GetPlayerFromCharacter(script.Parent)
if plr then
if plr.walkspeed then
script.Parent:FindFirstChild(“Humanoid”).WalkSpeed = plr.walkspeed.Value
plr.walkspeed.Value = script.Parent:FindFirstChild(“Humanoid”).WalkSpeed
end
end
end)
but now the problem is that the player starts with 0 walkspeed, is there a way to fix this?
my bad for late reply…
reasons its not working:
walkspeed data didnt load
its not applying correctly
The script is working perfectly fine! Its just that if the player joins first his walkspeed is at 0 so that means you cant walk, is there a way to fix this? Also sorry for my late reply!
My bad,
i did something wrong, its working now. Thank you so much for you’re help!
no problem!!!..
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.