So I'm making a game, with recruiting npc allies to help you fight. I found this model id spawner for example: I clicked when using the tool and it spawns an ally. But I can't find a way to remove it when I clicked once. I am also not experienced with scripting so I don't know how to.
I just did this at the end of the spawn model script
local function OnClick:Delete()
First you have to make the variable for the tool
local tool = game.StarterPack.Tool -- Replace tool with the name of your tool
Then you have to start with a proper function:
function(onClick) end tool.Activated:Connect(onClick)
Add this in the inside the function:
tool:Destroy()
All together now:
local tool = game.StarterPack.Tool -- Replace tool with the name of your tool function(onClick) tool:Destroy() end tool.Activated:Connect(onClick)
2nd Variation:
local tool = game.StarterPack.Tool -- Replace tool with the name of your tool tool.Activated:Connect(function(onClick) tool:Destroy() end)