i don't know programming too much so i tried this
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent:FindFirstChild('Humanoid') then
script.Parent:Destroy(game.Workspace.Trigger)
end
end)
but it didnt work can someone help ???
i don't know programming too much so i tried this
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent:FindFirstChild('Humanoid') then
script.Parent:Destroy(game.Workspace.Trigger)
end
end)
but it didnt work can someone help ???
You have to create a variable for the part you want to destroy. So like this:
local Trigger = game.Workspace.Trigger
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent:FindFirstChild('Humanoid') then
Trigger:Destroy()
end
end)
This should work and if it doesn't just let me know
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thank you it worked.
Also I would like to add that the reason your script doesn't work and the part deletes itself is because you typed "script.Parent:Destroy" .When you type "script.Parent" you are referencing the part the script is in. So you don't have to create a variable, you can just replace the line you wrote with "script.Parent.Parent.Trigger:Destroy()". I prefer creating a variable though as you can use it la