ScreenGui is not a part of playerGui

Hi! i am trying to find a way to show the amount of money player has just as soon as he joins.
but i keep getting an error saying “BaseGui is not a part of PlayerGui” (BaseGui is the name of my screenGui) i even used a findfirstchild to wait for the basegui to load but it did not work.

here is the script:

game.Players.PlayerAdded:Connect(function(plr)

	local data = Instance.new("Folder", plr)
	data.Name = "data"

	local playerhassword = Instance.new("IntValue", data) -- Create a score variable
	playerhassword.Name = "playerhassword" -- Name
	playerhassword.Value = 0 -- Initial Value
	
	local cash = Instance.new("IntValue", data)
	cash.Name = "cash"
	cash.Value = 100
	
	local BaseGUI = game:WaitForChild("StarterGui"):WaitForChild("BaseGUI")
	
	if BaseGUI then
		plr.PlayerGui.BaseGUI.Money.Text = plr.data.cash.Value .. "$"
	end
end)

my problem is in this part of the script:

	local BaseGUI = game:WaitForChild("StarterGui"):WaitForChild("BaseGUI")
	
	if BaseGUI then
		plr.PlayerGui.BaseGUI.Money.Text = plr.data.cash.Value .. "$"
	end

The reason its not working is because the player has their own separate GUI called the PlayerGui.

Make sure this “BaseGui” is in StarterGui.

Copy This Script.

-- previous code stays the same...
local BaseGUI = plr.PlayerGui:WaitForChild("BaseGUI")

BaseGUI.Money.Text = plr.data.cash.Value .. "$"

base gui for sure is in starter gui it even came in the drop down menu.

nevermind i guess it works now thanks

2 Likes