How would I limit tool to one use without deleting the tool?
I am currently working on a game and when you use a tool it will play an animation and pick randomly from a table but the issue is that you can use the tool multiple times and it would pick more then one item from the table and play the animation multiple times. The animation also uses the tool as a prop so it can't be deleted. How would I approach making it so you still have the tool but the function only runs once?
02 | handle = tool:WaitForChild( "Handle" ) |
03 | plr = game.Players.LocalPlayer |
05 | tool.Activated:Connect( function () |
12 | local anim = Instance.new( "Animation" , plr.Character) |
14 | local pAnim = plr.Character:WaitForChild( "Humanoid" ):LoadAnimation(anim) |
17 | local value = math.random( 1 , 2 ) |
18 | local pickedValue = Stands [ value ] |
19 | print ( tostring (pickedValue)) |