When touching a object, my GUI dosen't change its visible property

I have a game easter egg basically where you put in a hidden code, and it reveals a donut. I haven’t moved the position of the donut outside the area, so you can touch it at any point, and access the ending. When I wrote a local script, I was able to reference the “Donut” part, and I was able to print a word after every “Wait” time in the code, to make sure the code works. Everything works except the GUI change. (Printing, Waiting, and Kicking from the server.) Here is a code sample of what I wrote, and the object in the workspace.

local endinggui = game.StarterGui.Ending
local donut = game.Workspace.Donut
local player = game.Players.LocalPlayer
local debouce = false

donut.Touched:Connect(function()
if debouce == false then
debouce = true

  wait(0.3)
  
  print("gaming!!!!")

  endinggui.Frame.Visible = true

  wait(0.5)
  
  print("gaming1!!!!")

  endinggui.Frame.Ending.Visible = true

  wait(0.5)
  
  print("gaming2!!!!")

  endinggui.Frame.EndText.Text = "Donut"
  endinggui.Frame.Ending.Visible = true

  wait(5)
  
  print("gaming3!!!!")

  player:Kick("yummy donut")
  
  debouce = false

end
end)

StarterGUI Ending Frame
image

Workspace Object
image

The Badge and Code are separate pieces, and not related to the GUI issue. The Local Script from above is in StarterGUI.

1 Like

This internally hurts me

The StarterGui is referenced by the server side, try this for your variables:

local donut = game.Workspace.Donut
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local endinggui = PlayerGui:WaitForChild("Ending")
local debouce = false
3 Likes

Sorry about that, I am still learning, but thanks for your feedback.

2 Likes

I feel like a lot of people get confused by it :sweat_smile: You’re fine, it’s just mainly due to how the script auto-fills the StarterGui so easily I’d assume but the StarterGui’s components are actually gonna be replicated to the Player’s PlayerGui

2 Likes