How would i make a part that destroys a LocalScript when touched?

Hi! I’m just wondering about how i would make a script that destroys a local script, but only for the people that touched a part using a ClickDetector.

Keep in mind that i have very little experience in scripting so i dont know much

make this a local script:

local clickdetector = [your clickdetector]
local script = [your local script that you want to delete]


where would i put the scripts? Sorry I’m new to scripting so i dont really know much

You could put the scripts under the clickdetector

and on the local clickdetector line you could do:

local clickdetector = script.Parent

For the local script line you could do for example:

local script = workspace.LocalScript

This is just an example on how to get a path of an object in the game files.

local debounce = false -- so it doesn't occur more than once
if not deb then

  deb = true



ClickDectectors and the .Touched events are two different things, could you be more specific?

This method uses the player parameter that the ClickDetector provides. Either this or you could try and figure out something with remote events.

local cd = “your click detector”

      — specify where the script is, for example

when i put the script that i want to disable under the clickdetector it doesnt work at all. It’s a StarterGUI Script

nevermind i figured it out! :slight_smile: Thanks!