Hello, I'm trying to make a script that will make a GUI in StarterGUI appear (Changing the visibility to true) when a player clicks a part in Workspace.
Here is my script:
script.Parent.Parent.Parent.Parent.ClickDetector.MouseClick:Connect(function() game.StarterGui.VehicleSelctionGUI.Frame.Visible = true end)
When a player joins the game, all of the contents inside StarterGui are locally cloned into that player's PlayerGui, so if you want to mess around with the guis of a specific player, it would be best to run your code on a localscript, as MouseClick replicates and the first parameter of MouseClick is the player who clicked.
So, you can match the player who clicked with the localPlayer to see if the localplayer is the one who clicked the button.
--Localscript (Preferably inside VehicleSelctionGUI.Frame) local Part = --Whatever part you are using local Player = game.Players.LocalPlayer Part.ClickDetector.MouseClick:Connect(function(plr) if plr == Player then script.Parent.Visible = true --if this isnt in VehicleSelctionGUI.Frame, reference it directly end end)
Hopefully this helped!