What's up with this touch to change name and color code?

I’m working on this drink code that when the player holds the drink and touches this part the name of the cup should change and the Part inside the Cup (drinkshould be visible and change color

The codes not working as if the part isn’t detecting the Cup tool

I’ve tried rewriting, changing the part, make it have a click detector but nothing.
(I’ve switched it back to touch)

heres a copy of my code:

script.Parent.Touched:Connect(function(part)
    if part.Parent.Name == "Cup" then
        part.Parent.Name = "Sparkle drink"
        for i, v in pairs(part.Parent:GetChildren()) do
            if v.Name == "Cup Colour" then
                v.BrickColor = BrickColor.new("Medium blue")
                v.Transparency = 0
            end
        end
    end
end) 

nvm figured it out with a kind fella who helped out

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