My UI doesn't appear

Hello! I’m trying to make an announcement system. The principle is that via a ScreenGui I put my message and I click on send and then it will look for another ScreenGui to make the message appear on the screen of the players.

The problem is that my script works but does not show the message so the 2nd ScreenGui

Script of SendButton :

local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")

script.Parent.Parent.SendButton.MouseButton1Click:Connect(function()
		player.leaderstats.Money.Value = player.leaderstats.Money.Value - 50
		game.StarterGui.InfoUI.Info.Visible = true
end)

1 Like

Is there any errors in the output?

This line.
You need to access it via PlayerGui or through script.Parent..(ancestry)

1 Like

Oh yeah I didn’t notice that i’m stupid

No no error I even wrote a print(“test”) in the script and it works so there is a problem with the part just above
image

I think like the guy said up top you need to change the game.StarterGui.Info part to PlayerGUI etc

1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")

script.Parent.Parent.SendButton.MouseButton1Click:Connect(function()
	leaderstats.Money.Value -= 50
	player:WaitForChild("PlayerGui").InfoUI.Info.Visible = true
end)

Also, I see you’re changing the player’s stats on the client, which is not very good/efficient, exploiters can easily ruin this. Try to use a remote event.

1 Like

Thanks a lot to you and @ProgrammersRightHand :slight_smile:

no problem :slight_smile: have a nice day or night

Night for me ^^ from France, thank’s you too !