Touched event not firing on part after duplicating

  1. What do you want to achieve? I’d like to make a Basepart that when touched, will make the player run faster.

  2. What is the issue? I had already made this script and it works perfectly fine, but after duplicating the same Basepart, the duplicated part would stop working.

  3. What solutions have you tried so far? I tried searching other similar topics but none works so far.

Code:

local brick = script.Parent

brick.Touched:Connect(function(otherPart)
    print("touched")
    local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
    if humanoid then
        print("Found hum")
        humanoid.WalkSpeed = 70
    end
end)
1 Like

This might be because your TeamCreate is turned on and that you have not committed the script on drafts tab. You can find Drafts on View Tab in studio, search for it.

When a script is not committed and is duplicated, then the code inside would not duplicate.

If this is not the issue, you might want to look into output for errors, and let me know.

I’ve checked and its said that TeamCreate is not enabled, so it should’ve saved immediately. Another thing I found out is that the duplicated part works if I didn’t trigger the original Basepart.

Any thoughts?

does the duplicated part still print ‘touched’ or ‘found hum’?

Yepp, it works perfectly fine.

this sounds stupid, but is the player already at walkspeed 70? you said that each part only works if it was the first part you used.

Nope. Because the reason I had make this speed part was to be a send-off to a large jump that once they make it, they would return to the original 25 speed.

So the player’s speed is 25 before touching the part.

EDIT: So it turns out that one of my LocalScripts was changing the Humanoid.WalkSpeed via Client-Side and so caused it to not change properly when the Server-Script of the BasePart fired. All I did to fix this was to use a RemoteEvent and change the Humanoid.WalkSpeed via Server-Side. It works perfectly fine now!

Thanks for helping!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.