Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Correct placing for my variable?

Asked by
pilotly 15
6 years ago

I just started scripting and i wanted it so that over a long period of time it would make a player go faster. Tho i cant find where to make it so it affects all my players or even so affects a player. Here is a test.

lol=game.players.Humanoid while true do wait(0.1) lol.WalkSpeed = 16 wait(0.1) lol.WalkSpeed = 18 wait(0.1) lol.WalkSpeed = 20 wait(0.1) lol.WalkSpeed = 22 wait(0.1) lol.WalkSpeed = 24 wait(0.1) lol.WalkSpeed = 26 wait(0.1) lol.WalkSpeed = 28 wait(0.1) lol.WalkSpeed = 30 wait(0.1) lol.WalkSpeed = 32 wait(0.1) lol.WalkSpeed = 34 wait(0.1) lol.WalkSpeed = 36 wait(0.1) lol.WalkSpeed = 38 wait(0.1) lol.WalkSpeed = 40 wait(0.1) lol.WalkSpeed = 42 wait(0.1) lol.WalkSpeed = 44 wait(0.1) lol.WalkSpeed = 46 wait(0.1) lol.WalkSpeed = 48 wait(0.1) lol.WalkSpeed = 50 end

0
It's /best/ you use a for loop. xD http://wiki.roblox.com/index.php?title=Loops#For TheeDeathCaster 2368 — 6y

1 answer

Log in to vote
-1
Answered by 6 years ago
Edited 6 years ago
local ffc=game.FindFirstChild
local players=game:GetService("Players")
local localPlayer=players.LocalPlayer
local char=localPlayer.CharacterAdded:wait()

for i=16,50,1 do
    wait(1) 
    local humanoid=ffc(char,"Humanoid")
    if humanoid then
        humanoid.WalkSpeed=i
    end
end

--I believe this is what your looking forward. If you want a shift to sprint, use the "UserInputService" and again, you would still use the for loop above. 
Ad

Answer this question