So basicaly i want to do a speed wrist band thing and i need help to make a cooldown. Heres the script

local uis = game:GetService("UserInputService")

uis.InputBegan:Connect(function(Input)
    if (Input.UserInputType == Enum.UserInputType.Keyboard) then
 if Input.KeyCode == Enum.KeyCode.F then
	for _,player in pairs(game.Players:GetPlayers()) do
    local plr = player.Character
	local trail = plr.Torso:WaitForChild("trail")
	




		local Part = Instance.new("Part", workspace)
						Part.CanCollide = false
						Part.Shape = "Block"
						Part.CFrame = plr:FindFirstChild("watch").CFrame
						Part.Anchored = true
						Part.Transparency = 0
						Part.FormFactor = "Custom"
						Part.Material = "Neon"
						Part.Color = Color3.new(1,0,0)
						Part.Size = Vector3.new(1,1,1)
					local mesh = Instance.new("SpecialMesh")
						mesh.Parent = Part
						mesh.MeshType = "Sphere"
						mesh.Scale = Vector3.new(0.1,0.1,0.1)
		
					local grower = coroutine.wrap(function()
						for i=1, 10 do
							Part.Transparency = Part.Transparency + 0.1
							mesh.Scale = mesh.Scale + Vector3.new(0.1,0.1,0.1)							
							wait()
						end
						Part:Remove()							
					end)
					grower()
					

for _,player in pairs(game.Players:GetPlayers()) do
    local hum = player.Character:WaitForChild("Humanoid")
print("connect")



hum.WalkSpeed = 25
trail.Enabled = true


wait(5)

  
	
	hum.WalkSpeed = 16
trail.Enabled = false
	

			
end
end
end
end
end)

2 comments

0

Check out debounce

0

Tell clearer, what do you means cooldown? I will help you if you replies.