Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.