Hey, im making a treadmill. !TreadMill And this is the Code
local deb= false local conveyer= script.Parent local stats= game.ServerStorage.PlrFolder local i= 0 local update= game.ReplicatedStorage.updateStats script.Parent.Touched:Connect(function(hit) if deb == false then deb=true if hit.Parent:FindFirstChild("Humanoid") then local plr= game.Players:GetPlayerFromCharacter(hit.Parent) if plr then local pf= stats[plr.Name] local speed= pf.Speed do for _,v in pairs(script.Parent.Parent.active:GetChildren()) do v.BrickColor= BrickColor.new("Lime green") end end while (hit.Position - conveyer.Position).magnitude < 10 and hit.Parent.Humanoid.MoveDirection ~= Vector3.new(0,0,0) do i=i+1 if i == 500 and speed < 40 then speed = speed+1 i=0 end wait() end do for _,v in pairs(script.Parent.Parent.active:GetChildren()) do v.BrickColor= BrickColor.new("Bright blue") end end i=0 end end deb=false end end)
But the walk speed does not increase:
if i == 500 and speed < 40 then speed = speed+1
I tried placing the = and the + on other spots like this.
if i == 500 and speed < 40 then speed = speed + 1
But as you already knew i did not work OOF So you guys know how to do this?
Treadmill: https://www.roblox.com/catalog/03133642024/redirect
Oh and the output says nothing
I am not good at programming my self so i might be wrong, but i will guess you have to change how you define the speed.(I don`t understand the pairs and stuff so i can only fix first few lines sorry.)
script.Parent.Touched:Connect(function(hit) if deb == false then deb = true if hit.Parent:FindFirstChild("Humanoid") then local humanoid = hit.Parent:FindFirstChild("Humanoid") local speed = humanoid.WalkSpeed --from here i do not know how to help sorry.
So after defining what speed represents by finding from humanoid part, it should change the speed to whatever you want.