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 1 year 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.

local showGUIEvent= game.ReplicatedStorage.ShowGUIEvent 

showGUIEvent.OnClientEvent:Connect(function()   
    local gui = game.StarterGui.NutGear 
    local frame = gui.YouGot 
    frame.Visible = true 

    -- debug
    print("You got all 8!")    
    print("Frame visibility is set to " .. tostring(frame.Visible))    
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.

1 answer

Log in to vote
0
Answered by 1 year ago

Bruh. When a player joins the game whoever is in StarterGui gets CLONED into the Player's "PlayerGui".

--This changes the GUI from the ServerStorage
    local gui = game.StarterGui.NutGear 
    local frame = gui.YouGot 
    frame.Visible = true 

--You want to change the players GUI
    local gui = game.Players.LocalPlayer.Gui.NutGear 
    local frame = gui.YouGot 
    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 — 1y
Ad

Answer this question