Touched fuction not registering?

So i have a button script in a part, and its just a basic Touched function-
and i coded it so it only registers a part names “Shell” but its only registering the
players parts and not the shell…

button script :
image

The shell has a body position, and a body gyro in it. But it is not anchored so why is it not registering???
image
Its also in replicated storage so i can clone() it into the workspace.

EDIT SOLVED : I’m pretty sure its because I’m moving the shell to the workspace through a local script.

1 Like

It could possibly be because it’s a mesh? Maybe transform it into a mesh part. This solution might not be as ideal since it’s night and I’m a little tired

2 Likes

So is shell on the player or a thing in the workspace?

1 Like

Thing in the workspace.

(got to hit the word quota)

Have you tried it without the print?

yes, the same result

(thirty letters.)

I tested it on my game with something similar its working for me.

Can I ask if any error has been printed out in the Output Window when player does touch part other than your print Touched and Shell? Can I also ask if both Touched and Shell do print out when a player touches the part?

Also would recommend using local for buttoned. (local buttoned = false)

Use this its working for me

local Buttoned = false
script.Parent.Touched:Connect(function(hit)
    if hit.Name == "Shell" then
        print("Shell")
        if Buttoned == false then
            Buttoned = true
            script.Parent.Parent.Bridge.CanCollide = true
            script.Parent.Parent.Bridge.Transparency = 0
            for i = 1,15 do
                script.Parent.switch:Play()
                wait(1)
            end
            script.Parent.Parent.Bridge.CanCollide = false
            script.Parent.Parent.Bridge.Transparency = 1
        end
    end
end)

No errors when its touched. And just “touched” is printed when the player touches it because no part that touches it is named “Shell”

Reason why it kept printing Touched is because you had it before you wanted to find the shell.

If it is not solved yet, can you send a file of the place so it’s easier to indentify the problem?

No thanks I think i just solved it

1 Like

What do you mean by hit.Name? c