You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
for the humanoid property to be saved to the player
What is the issue? Include screenshots / videos if possible!
when i load into the game the speed is reset to the default speed
and it dosen’t want to load nor save
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i have looking into the issue before but had not luck i looked on the Hub and couldn’t find an answer
My solution would be to make a leaderstats of the speed of each player and the value as there speed so you can constantly update the value to the current speed then just watch this video of datastores:
(Please reply to me instead of yourself so I can get a notification)
To do this you need to use DataStoreService. Create a script in ServerScriptService.
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local SpeedDataStore = DataStoreService:GetDataStore("SpeedDataStore")
Players.PlayerAdded:Connect(function(player)
local SpeedValue = Instance.new("NumberValue")
SpeedValue.Name = "SpeedValue"
SpeedValue.Parent = player
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid then repeat Character.ChildAdded:Wait() until Character:FindFirstChildOfClass("Humanoid")
local Speed = SpeedDataStore:GetAsync(player.UserId) or 16
Humanoid.WalkSpeed = Speed
Player.CharacterAdded:Connect(function(char)
char.Humanoid.WalkSpeed = Speed
end)
Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
SpeedValue.Value = Humanoid.WalkSpeed
end)
Players.PlayerRemoving:Connect(function(player)
local SpeedValue = player:FindFirstChild("SpeedValue")
if not SpeedValue then return end
SpeedDataStore:SetAsync(player.UserId, SpeedValue.Value)
end)
Yes, I forgot about it. He either has Studio access to API services disabled, either the problem is that he needs to add a game:BindToClose() function.
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local SpeedDataStore = DataStoreService:GetDataStore("SpeedDataStore")
Players.PlayerAdded:Connect(function(player)
local SpeedValue = Instance.new("NumberValue")
SpeedValue.Name = "SpeedValue"
SpeedValue.Parent = player
local Character = player.Character or player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid then repeat Character.ChildAdded:Wait() until Character:FindFirstChildOfClass("Humanoid")
local Speed = SpeedDataStore:GetAsync(player.UserId) or 16
Humanoid.WalkSpeed = Speed
Players.CharacterAdded:Connect(function(char)
char.Humanoid.WalkSpeed = Speed
end)
Humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
SpeedValue.Value = Humanoid.WalkSpeed
end)
Players.PlayerRemoving:Connect(function(player)
local SpeedValue = player:FindFirstChild("SpeedValue")
if not SpeedValue then return end
SpeedDataStore:SetAsync(player.UserId, SpeedValue.Value)
end)
end
end)
game:BindToClose(function()
wait(3)
end)