Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Correct placing for my variable?

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

1 comment

0

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

1 answer

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. 

This discussion is preserved as it was. New answers, comments, and votes are closed.