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

How do i get a my screen gui to enable when i click the button?

Alright so im trying to make a finding the button game. I got everything set up and i want a gui to appear when i click the button so i have it disabled initially then i want the script to enable it. This is what i have.

local lvlpassed = game.StarterGui.ScreenGui


function onClicked(playerClicked)

	script.Parent.Transparency=1
	lvlpassed = game.StarterGui.Enabled
	wait(1)
	script.Parent.Transparency=0
	
	playerClicked.Character.HumanoidRootPart.CFrame = CFrame.new(-107.9, 1.5, -223.1)
	
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 answer

Well, StarterGui is where you place GUIs for people to spawn with, not where guis are stored within the players. To access those using a script, you'll need to go through the player like this

game.Players[playerClicked.Name].PlayerGui.ScreenGui.Enabled = true

This would edit the player's UI to be visible.

1 comment

0

Thank you this helps a lot!

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