I made this LocalScript in StarterPlayerScripts that fires when a player touches 8 specific parts. It is supposed to change a Frame's visiblity property to true, but it doesn't.
01 | local showGUIEvent = game.ReplicatedStorage.ShowGUIEvent |
02 |
03 | showGUIEvent.OnClientEvent:Connect( function () |
04 | local gui = game.StarterGui.NutGear |
05 | local frame = gui.YouGot |
06 | frame.Visible = true |
07 |
08 | -- debug |
09 | print ( "You got all 8!" ) |
10 | print ( "Frame visibility is set to " .. tostring (frame.Visible)) |
11 | end ) |
The script fires fine, and "You got all 8!" and "Frame visibilty is set to true" is printed, but the frame isn't visible.
Bruh. When a player joins the game whoever is in StarterGui gets CLONED into the Player's "PlayerGui".
1 | --This changes the GUI from the ServerStorage |
2 | local gui = game.StarterGui.NutGear |
3 | local frame = gui.YouGot |
4 | frame.Visible = true |
5 |
6 | --You want to change the players GUI |
7 | local gui = game.Players.LocalPlayer.Gui.NutGear |
8 | local frame = gui.YouGot |
9 | frame.Visible = true |
If you get an error like "PlayerGui is not a member of game.Player.Localplayer" It's maybe because it hasn't loaded yet. You would use game.Players.LocalPlayer:WaitForChild("PlayeGui") in order to fix these issues.
I really hope this helps