I’ve been trying to change humanoid walkspeed to an intvalue found in replicatedstorage however it doesn’t seem to work and still uses the default walking speed (16)
local speed = game:GetService("ReplicatedStorage"):WaitForChild(Character.Name):WaitForChild("Speed")
--Localscript in StarterCharacterScripts.
local Character = script.Parent
while true do
Character.Humanoid.WalkSpeed = speed.Value
end
local speed = game:GetService("ReplicatedStorage"):WaitForChild("Stats"):WaitForChild("WalkSpeed")
local Character = script.Parent
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
local firstRun = true
while speed.Changed:Wait() or firstRun do
Humanoid.WalkSpeed = speed.Value
firstRun = false
end
Okay, remove the firstRun stuff. Try while Character.Parent do and add a line at the end of the loop speed.Changed:Wait(). Add a line at the top of the script that says task.wait(0.5) (used to prevent replication failures).
If you want it to run when it changes, use GetPropertyChangedSignal.
-- assuming this is all in the same script located in the character --
local Character = script.Parent
local speed = game:GetService("ReplicatedStorage"):WaitForChild(Character.Name):WaitForChild("Speed")
local humanoid = Character:WaitForChild("Humanoid")
local function update()
humanoid.WalkSpeed = speed.Value
end
speed:GetPropertyChangedSignal("Value"):Connect(update)
update()