So I have 2 local scrips in starter Character and a intValue called steps in replicated storage. What I am doing in the first script is changing the value of steps( A intValue in ReplicatedStorage) Then in the second script I am trying to change the character speed to the Steps they take but the value is not updated and everytime the script sees the value of steps as zero.
this local script is to add steps to the player if they are running-
local player = game.Players.LocalPlayer local Steps = game.ReplicatedStorage.Steps.Value local runningone = game.ReplicatedStorage:WaitForChild("Running") local running = runningone.Value--bool to determine if player is running local character = game.Players.LocalPlayer.Character local WalkSpeed = character.Humanoid.WalkSpeed character.Humanoid.Running:connect(function(speed) -- return value; speed of the running if speed > 0 then running = true game.ReplicatedStorage.RemoteEvent:FireServer() elseif speed == 0 then running = false end end) while true do while running == true do -- adds steps to the player Steps = Steps +1 player.leaderstats.Steps.Value = Steps wait(.5) end wait(.5) end
this local script is to change the players speed from the steps
local player = game.Players.LocalPlayer local Steps = game.ReplicatedStorage.Steps.Value while true do player.Character.Humanoid.WalkSpeed = (Steps +1)*10 print(Steps) wait(.5) end
please use a code block its the blue lua