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

Help me with the touch event!! Can u help me? [closed]

Asked by 4 years ago

How can i make a part that if u touch other part disappear

Closed as Not Constructive by hiimgoodpack and User#5423

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

3 answers

Log in to vote
0
Answered by 4 years ago

This script is about where if you touch Part1, part2 will "disappear" (I'm assuming you mean go transparent).

local part2 = game.Workspace.part2 --Replace Part2 with the name of the part that you want to disappear

function onTouched()
part2.Transparency = 1 --Or do part2:Destroy() if you want it completely removed
end

script.Parent.Touched:Connect(onTouched)

Like I said, you need to be more specific and try to include code snippets. This wont work for models, otherwise you'd have to include every single piece in the script.

Hope this helps!

Ad
Log in to vote
0
Answered by 4 years ago

The above script is if you want to completely remove it

local PART2NAME= game.Workspace.PART2NAME--Replace Part2 with the name of part2

function onTouched()
PART2NAME:Destroy()
end

script.Parent.Touched:Connect(onTouched)

The below script is if you want to make it invisible

local PART2NAME= game.Workspace.PART2NAME--Replace Part2 with the name of part2

function onTouched()
PART2NAME.transparency = 1
end

script.Parent.Touched:Connect(onTouched)

Please try to add your coding attempt(s) so I can help you more next time.

Log in to vote
0
Answered by 4 years ago
local part = game.Workspace.Part -- Get the part that you want 

part.Touched:Connect(function() -- if someone touched the part then connect to this function
    -- Everything here inside this function is going to run after the part is touched

    part.Transparency = 1 -- the part will disappear, if you want  to remove it completely then write part.Destroy()
end)

Hope this helped