GUI not showing up with this script

Hey, my script is not working, it’s suppose to make the gui pop up but it doesn’t.

Script

local MoneyStolenGUI = game.StarterGui.MoneyStolen

game.StarterGui:WaitForChild("MoneyStolen")

script.Parent.PromptButtonHoldBegan:Connect(function(player)
	print(player.Name.." Is stealing money at Northwest Bank")
end)
script.Parent.PromptButtonHoldEnded:Connect(function(player)
	print(player.Name.." Has stole money at Northwest Bank")
	MoneyStolenGUI.Enabled = true
end)

Not even 5 seconds looking, you’re getting the StarterGui oof

Change that to the Player’s Gui instead, possibly referencing inside your PromptButton Events

local MoneyStolenGui

script.Parent.PromptButtonHoldBegan:Connect(function(player)
	print(player.Name.." Is stealing money at Northwest Bank")
    MoneyStolenGui = player.PlayerGui:WaitForChild("MoneyStolen")
	MoneyStolenGUI.Enabled = true
end)
script.Parent.PromptButtonHoldEnded:Connect(function(player)
	print(player.Name.." Has stole money at Northwest Bank")
	MoneyStolenGUI.Enabled = false
end)

Also did you mean to enable the Gui when the prompt was triggered…?

1 Like

I get an error
image
image

I forgot to reference the Player’s Gui, try again a