Is it possible to save a character's WalkSpeed? and is it possible to save a character's WalkSpeed with this method?

local ds = game:GetService("DataStoreService")

local speed = ds:GetDataStore("Walk")


game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local humanoid = char.Humanoid
		humanoid.WalkSpeed = speed:GetAsync(tostring(player.UserId)) or 16
			
			humanoid.Changed:Connect(function()
				speed:SetAsync(player.UserId, humanoid.WalkSpeed)
			end)
	end)
end)

3 comments

0

theres a limit to how many times u can use :SetAsync and theres no need to do tostring(plr.userId)

0

that should work just fine, but you should use: humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function() instead of just: .Changed. additionally, make sure your CharacterAdded is running

0

and yes, you can save integer value to datastore