Gui not appearing

Hello! Does anyone know why this script wont make the ui appear? this script is in a physical button and it is a local script

local houses = game.ServerStorage.Houses
local houseMenu = game.StarterGui

function onClicked()
game.StarterGui.Houses.Visible = true
game.StarterGui.Houses.Frame.Visible = true
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

The script is making the ui found in StarterGui visible.

All of the uis in startergui are given to the players when they join, but making changes to those uis after they have been given to the players will not effect the player’s uis.

To make changes to the player’s ui in a local script, use game.Players.LocalPlayer.PlayerGui instead of game.StarterGui.

it still doesnt work, do i have to move the ui somewhere else too

You may need to wait for PlayerGui to exist.

Use .Enabled for screen guis and .Visible for everything else

local plr = game.Players.LocalPlayer
local pgui = plr.PlayerGui

function onClicked()
  pgui.Houses.Enabled = true
  pgui.Frame.Visible = true
end