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

"ClickDetector is not a valid member of part." Works in-studio but not in-game..?

Asked by 6 years ago
script.Parent.ClickDetector.MouseClick:connect(function(player)
    player.PlayerGui.ItemShop.Price.Value = 3
    player.PlayerGui.ItemShop.ItemName.Value = "Bloxy Cola"
    player.PlayerGui.ItemShop.Enabled = true
end)

This is a script that is a child of a part named "hitbox."

Hitbox harbors 3 children - said Script, a ClickDetector, and a Mesh.

ItemShop is the name of a ScreenGui I placed in StarterGui. ItemName is a StringValue inside ItemShop, and Price is an IntValue inside ItemShop.

When I click the part while playing Solo mode in Studio, it works perfectly. Doesn't work at all in a server game, and gives me the error, "ClickDetector is not a valid member of part." when I check the Developer Console.

1 answer

Log in to vote
0
Answered by 6 years ago

Studio and the actual game are two completely different concepts.

I know this is a pain, but try putting the GUI inside the script, then copying it into the person who clicked it

Ad

Answer this question