Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make a script that delets parts?

Im making a sun model and I want it to kill players and delete parts when they are near the sun but I dont know how to make a script that deletes parts when they touch the sun model. How do I do that?

2 comments

0

You would have to do a .touched event for the part that activates the script and then to delete parts you target the part and do :Destroy()

0

Thanks

1 answer

✓ Accepted answer

Pretty simple, like what deth said, just like this:

local Part = game.Workspace.Part

Part.Touched:Connect(function(hit)
	hit:Destroy()
end)

or for player do

local Part = game.Workspace.Part

Part.Touched:Connect(function(hit)
	local Char = hit.Parent
	if Char.Humanoid then
		Char.Humanoid.Health = 0
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.