Is it possible to detect what part is hitting another part?
I wish to make it so that if a part named "One" hits a part named "Back" then it will make "Back"'s transparency equal to 1.
Is it possible to detect what part is hitting another part?
I wish to make it so that if a part named "One" hits a part named "Back" then it will make "Back"'s transparency equal to 1.
You will need to use a Touched event, passing the part called "Back" as the target of the function parameter, using an "if" condition, like this:
local one = workspace:WaitForChild("One") -- Your "One" part.
local Back = workspace:WaitForChild("Back") -- Your "Back" part.
Back.Touched:Connect(function(Part) -- "Part" is the parameter what we want to be "One".
if Part.Name == "One" then -- if "One" hits "Back" then:
print("It is One!")
Back.Transparency = 1
else
print("It isn't One, it is".. Part.Name.."!")
end
end)
print("ola mundo da lua!")
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
Hm it didn't work for some reason. What should I do?
What does output says?
It says nothing... Hmm
Nevermind, just tweaked something. It works! Thank you so much!