Still have questions? Join our Discord server and get real time help.
0

# Click to remove tool? (Still not answered)

Edited 6 months ago

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()

0
just that at the end of the spawn model script? Just that? all you did was made a function. In fact by the looks of it you barley even made the function. Let alone calling the function. Is there anything else? at all? Ozzisiya 67 — 6mo
0
Yeah.. I couldn't think of anything else trying to remove the item when clicked. Rdumb1 4 — 6mo
0
Instead, it justs deletes the spawned ally if you put the line in. Rdumb1 4 — 6mo

0

First you have to make the variable for the tool

local tool = game.StarterPack.Tool -- Replace tool with the name of your tool


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)

0
will this be local or normal script? Rdumb1 4 — 6mo
0
Normal is the only way AidanTES -9 — 6mo
0
If you use a local script 1. The tool won't destroy for others 2. The NPC will not spawn AidanTES -9 — 6mo
0
Where do I put the script? Rdumb1 4 — 6mo
0
Inside your tool which should be in the starter pack AidanTES -9 — 6mo
0
If this worked please press accept answer below! ;) AidanTES -9 — 6mo
0
So I put script in the recruit tool, but doesn't disappear.. I tried the 2nd Variation too. Rdumb1 4 — 6mo
0
Are you trying in studio or in the game itself? Sometimes it doesn't work in studio AidanTES -9 — 6mo
0
what you should do is upload the game and make it private AidanTES -9 — 6mo
0
Do you have FE? (Filtering Enabled) check in workspace's properties if yes switch it off AidanTES -9 — 6mo
0
Its a 1 player game, and it is private. And some scripts may not work without fe.. Rdumb1 4 — 6mo
0
all scripts work without fe some scripts don't work with fe AidanTES -9 — 6mo
0
and I'm testing it on studios. Rdumb1 4 — 6mo
0
And um.. It doesn't work ingame without fe. Rdumb1 4 — 6mo
0
*does not work on both fe and not fe Rdumb1 4 — 6mo
0
Test it in game AidanTES -9 — 6mo
0
Nope, still doesn't work. Rdumb1 4 — 6mo