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

How would I make this script only activate after I use my tool 5 times?

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild('Humanoid')

script.Parent.Activated:connect(function()
	if humanoid then
		humanoid.Health = humanoid.Health + 0 --
		wait(2)
		script.Parent:remove()
	end
end)

1 answer

Use a check

local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character:FindFirstChild('Humanoid')
local Index = 0
local Max = 5

script.Parent.Activated:connect(function()
    if humanoid and Index == Max then 
        humanoid.Health = humanoid.Health + 0 --
        wait(2)
        script.Parent:remove()
    else
	Index = Index + 1
    end
end)

2 comments

0

this is what i thought

0

That's perfect. Thank you so much

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