Help with button pressed script

local button = script.Parent
WaterIm = game.StarterGui.SlideGui.TpAndAbout.ScrollingFrame.Water
town = game.StarterGui.SlideGui.TpAndAbout.ScrollingFrame.Town
Hatred = game.StarterGui.SlideGui.TpAndAbout.ScrollingFrame.Hatred

local function buttonPressed()
	Hatred.Visible = false
	WaterIm.Visible = true
	
end


button.MouseButton1Click:Connect(buttonPressed) ```


trying to make it where once u press the button the images switch but it dont work any help
1 Like

This is the issue. Once the game has started, GUIs are actually inside of game.Players.LocalPlayer.PlayerGui, not game.StarterGui!

1 Like

It still doesn’t work abd says playergui is not a valid member of “ Player.cosnez

Did you make sure to get the capitalization right?


Also make sure you use :WaitForChild()

game.Players.LocalPlayer:WaitForChld("PlayerGui")

Edit: Credit to @nicemike40 for mentioning

1 Like