I'm trying to figure this out but I have no idea how to do it.
If you wanted to make sure that the other part is a part, then you would use the IsA()
function with a Touched
event.
game.Workspace.Part.Touched:connect(function(part) --Touched event if part:IsA("Part") then --IsA() function --code end end)
Or, if you wanted the touching part to be another type of part, like a MeshPart
, or WedgePart
, you would check if it is a BasePart
.
game.Workspace.Part.Touched:connect(function(part) --Touched event if part:IsA("BasePart") then --IsA() function --code end end)
Good luck!
If this helps, please be sure to accept my answer as this benefits the both of us.
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched
Workspace.Part.Touched:connect(function(otherPart) if otherPart.ClassName = "Part" then end end)
You would first create the function -- Workspace.Part.Touched:connect(function(otherPart) then you would check if the other part is named what you'd like it to be named, it could be object, or anything---- if otherPart.ClassName = "Example" then after this, you'd insert your code. You could do this with a player, but you'd need to check for the humanoid.
If this helped, make sure to accept answer!