local plr = game.Players.LocalPlayer
local rp = game:GetService('ReplicatedStorage')
local notification = game.StarterGui.Notification
script.Parent.MouseButton1Click:connect(function()
if plr.Backpack:FindFirstChild('PirateSword') or plr.StarterGear:FindFirstChild('PirateSword')or
game.Workspace[plr.Name]:FindFirstChild('PirateSword') then
notification.Base.Visible = true
notification.Base.Text = 'You Already Purchased This'
wait(1.5)
notification.Base.Visible = false
else
if plr.leaderstats.Coins.Value >= 50 then
rp.PirateSword:Clone().Parent = plr.Backpack
rp.PirateSword:Clone().Parent = plr.StarterGear
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value - (50)
else
local cashrequired = 50 - plr.leaderstats.Coins.Value
notification.Base.Visible = true
notification.Base.Text = 'You Need '..cashrequired..' More Coins To Buy This!'
wait(1.5)
notification.Base.Visible = false
end
end
end)
✓ ANSWER ACCEPTED
I want a UI to pop up, however it doesn't happen. What did I do wrong?
1 answer
✓ Accepted answer
When player joins the game, folder where all his guis are kept is named PlayerGui. Path to your notification will be:
game.Players.LocalPlayer.PlayerGui.Notification
so with your variable it will be:
plr.PlayerGui.Notification
1 comment
0
Thank you so much, I don't know why I didn't realize ...
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
The entire code has to go in between the two long "~~~~~~" lines so the code can be formatted correctly in Lua.
Ty just realized