Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the frame not turn visible?

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

✓ Accepted answer

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

1 comment

0

This worked, I knew the answer was something simple. It's game.Players.LocalPlayer.PlayerGui.NutGear though.

This discussion is preserved as it was. New answers, comments, and votes are closed.