Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I make a script that delets parts?

Asked by 4 years ago

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?

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() deth836231 142 — 4y
0
Thanks Manuelolol 22 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
Ad

Answer this question