Hello, I am having trouble removing models all together. It s supposed to remove the model everytime the player touches but it won't work How can I remove the model when the player touches it? The code I am using right now deletes only the part on which the script is while I want the whole thing Regards,
This is the code i ve been using:
> script.Parent.Touched:Connect(function(grow) > function touch() > script.Parent:remove() > end > > script.Parent.Touched:connect(touch) > end) >
So if you want to remove a model if a player touches a part of the model this should work.
This script would go into the part you want to touch.
script.Parent.Touched:Connect(function(hit) --Detects if something touches the part. local model = script.Parent.Parent --Defines what the model is. if hit.Parent then --Checks if hit has a parent. if hit.Parent:FindFirstChild("Humanoid") then --Checks if it has a humanoid. model:Destroy() --If it does then destroy the model. end end end)
This would destroy the model if a player touches it.
Upvote if this helps :)
script.Parent.Touched:Connect(function(hit) -- if it gets hit game.Workspace.YOURMODELNAME:Remove() -- the model gets removed end) -- then it all ends
No need for all that extra