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

how do i make the walk speed of a group of things with dif walk speeds back to the same?

how do i make my group of things back to there normal walkspeed after changing it

heres what i got

                                    local Walkspeed = Target.Humanoid.WalkSpeed
					Target.Humanoid:TakeDamage(_Damage.Value)
					Target.Humanoid.WalkSpeed  = 0
				wait(_icetime)
					Target.Humanoid.WalkSpeed =  Walkspeed

they all have a dif walk speed i want them after they get iced to go back to original walkspeed

1 answer

I'm not sure what you mean by "they"?

I would use a for loop, and store their previous WalkSpeed in a variable to refer back to after the wait(). I also can't use your variables so you'll have to modify my code to fit your needs.

local Players = game:GetService("Players")

for i,v in pairs(Players:GetPlayers()) do -- for loop
	local char = v.Character or v.CharacterAdded:Wait() 
	local hum = char:WaitForChild("Humanoid")
	local oldWalkSpeed = hum.WalkSpeed -- Old WalkSpeed variable, i.e. 16
	print(oldWalkSpeed)
	
	if hum then
		hum.WalkSpeed = 0  -- WalkSpeed to 0
		wait(_icetime)
		hum.WalkSpeed = oldWalkSpeed -- WalkSpeed to 16
		print(hum.WalkSpeed)
	end
end

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