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
7 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 — 7y

1 answer

Log in to vote
-1
Answered by 7 years ago
Edited 7 years ago
01local ffc=game.FindFirstChild
02local players=game:GetService("Players")
03local localPlayer=players.LocalPlayer
04local char=localPlayer.CharacterAdded:wait()
05 
06for i=16,50,1 do
07    wait(1)
08    local humanoid=ffc(char,"Humanoid")
09    if humanoid then
10        humanoid.WalkSpeed=i
11    end
12end
13 
14--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