Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make tool destroy when value reaches specific number?

Asked by 3 years ago
Edited 3 years ago

I'm making a food simulator and i made a pizza. every time you activate tool it adds +1 to int value, how to make the tool destroy after the int value value reaches 3?? I really need your help guys

1 answer

Log in to vote
0
Answered by 3 years ago

Tool = script.Parent -- Tool TimesActivated = 0 -- The value. Tool.Activated:Connect(function() -- Fires whenever the tool is activated. if TimesActivated > 2 then --Checks if it is over the value of 2! Tool:Destroy() -- Removes the tool. else TimesActivated=TimesActivated+1 -- Increases the value. end end)

0
put it in a lua script box so he can understand better. Nitrolux200 62 — 3y
Ad

Answer this question