No Kick Cooldown

Edit: I Fixed it, but here’s my code if you want it.

kickPlayer2 = false

if input.KeyCode == Enum.KeyCode.R then
			kickPlayer2 = not kickPlayer2
			if kickPlayer2 == true then
				followPlayer2 = "Kick"
				game.Workspace:WaitForChild(game.Players.LocalPlayer.Name.."2").KickAnimation:FireServer("Play")
				kickPlayer2 = false
				wait(1)
					followPlayer2 = true
			end
			if kickPlayer2 == false then
				wait(5)
				kickPlayer2 = true
			end
		end
1 Like

The problem is here. Whenever the kickPlayer2 is false, this sets it to true, and when it’s true, it sets it to false. So remove this line.

And set this to true. I hope this will solve your problem.

But doing that would make the player have to wait 5 seconds just for it to execute.

I don’t really think it will, just try it and get back to me with your results, you can’t loose anything :slight_smile:

Now it’s not executing, here’s my code:

local kickPlayer2 = true
if input.KeyCode == Enum.KeyCode.R then
			kickPlayer2 = false
			if kickPlayer2 == true then
				followPlayer2 = "Kick"
				game.Workspace:WaitForChild(game.Players.LocalPlayer.Name.."2").KickAnimation:FireServer("Play")
				kickPlayer2 = false
				wait(1)
					followPlayer2 = true
			end
			if kickPlayer2 == false then
				wait(5)
				kickPlayer2 = true
			end
		end
1 Like
local kickPlayer2 = false

if input.KeyCode == Enum.KeyCode.R then
			if not kickPlayer2 then
			kickPlayer = true
				followPlayer2 = "Kick"
				game.Workspace:WaitForChild(game.Players.LocalPlayer.Name.."2").KickAnimation:FireServer("Play")
				kickPlayer2 = false
				wait(1)
					followPlayer2 = true
                                      wait(4)
                                    kickPlayer2 = false
			end
			end
		end

try that

EDIT: did an edit so retry, forgot to add the local @Q4_42

1 Like

3rd line should be removed. (30 chars)

1 Like

Thanks for both of your help, but I can still spam it.

local kickPlayer2 = true
if input.KeyCode == Enum.KeyCode.R then
    if kickPlayer2 == true then
        kickPlayer2 = false
        followPlayer2 = "Kick"
		game.Workspace:WaitForChild(game.Players.LocalPlayer.Name.."2").KickAnimation:FireServer("Play")
		wait(1)
		followPlayer2 = true
        wait(4)
        kickPlayer2 = true
	end
end

This one works?