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

Why does the frame not turn visible?

Asked by 2 years ago

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.

01local showGUIEvent= game.ReplicatedStorage.ShowGUIEvent
02 
03showGUIEvent.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))   
11end)

The script fires fine, and "You got all 8!" and "Frame visibilty is set to true" is printed, but the frame isn't visible.

1 answer

Log in to vote
0
Answered by 2 years ago

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

0
This worked, I knew the answer was something simple. It's game.Players.LocalPlayer.PlayerGui.NutGear though. BunjiBloxxer 51 — 2y
Ad

Answer this question