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

How would I make it display the connected part's name if it spawns inside the connected part?

Asked by 3 years ago

So here's my code so far.

local part = script.Parent.Collision

local function onPartTouched(otherPart)
    print("Checked collision with " .. otherPart.name)
end

part.Touched:Connect(onPartTouched)

Now the problem I'm having is that the Collision part loads in colliding with otherPart, which is exactly what I want it to do. However the problem lies with it not running the function due to the aforementioned reason.

I know this is the cause because if I raise Collision up and let it fall onto otherPart it prints the name. How would I fix this?

Answer this question