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
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]
clickdetector.MouseButton1Down:Connect(function()
script:Destroy()
end)
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
[PART].Touched:Connect(function()
if not deb then
deb = true
[SCRIPT]:Destroy()
end
end)
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”
cd.MouseClick:Connect(function(player)
— specify where the script is, for example
player.PlayerGui.MainGui.LocalScript:Destroy()
end)
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! Thanks!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.