✓ Accepted answer
##Problem
You're trying to change the Visibility value of an object in StarterGui which does not replicate to all players or even a specific player instantaneously.
##Solution
StarterGui is what it is, it's a Starter. Whenever your character respawns it will see the changes. However with your code, you would want to have the Gui show up for a specific person. What the Clicked event provides is a way to get the player object. Whenever a player clicks on a part, then the ClickDetector will get the player who clicked it. You can then use that object and start using the PlayerGui object of all players. PlayerGui is what a player would see on screen, manipulating it for one player will only make it visible to that player. Basically saying that GUI can only be seen by that client.
##Final Script
script.Parent.ClickDetector.MouseClick:connect(function(PlayerWhoClicked)
local gui = PlayerWhoClicked.PlayerGui.BuyHouse
gui.Visible = true
end)
##Warnings
Your code has no protections of it, so if you were to click on the sign and you did not have a PlayerGui object in your player then the script would error. Or even if the names of the objects were changed.
######Hopefully this answered your question. If you have any questions, feel free to comment below.
1 comment
im not a professional sorry if i wrote an inefficient code or something