Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a roblox overhead GUI when the player gain "money"?

I want to make a roblox overhead GUI to show how much the player gain. I'm quiet new so i really don't know what I'm doing wrong....

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
	if player.Name == "" then
		local clonedgui = billboardgui:Clone()
		clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		clonedgui.TextLabel.Text = "Money: ".. stats.Value
		clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231,206,12)
		clonedgui.TextLabel.TextTransparency = 1 
		if stats.Changed then
			clonedgui.TextLabel.TextTransparency = 0 
			if false then return
					
		end
		end
	end

4 comments

0

Any errors?

0

Oh and it might be the "if false then return"

0

just that? if i want the script to go back what i do then?

0

no errors appearing

1 answer

✓ Accepted answer
local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
game.Players.PlayerAdded:Connect(function(player)
	wait(1)
	local stats = Instance.new("Folder",player)
	stats.Name = "leaderstats"
	local Money = Instance.new("IntValue",stats)
	Money.Name = "Money"
    	player.CharacterAdded:Connect(function(char)
    
        	local clonedgui = billboardgui:Clone()
       		 clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
       		 clonedgui.TextLabel.Text = "Money: ".. Money.Value
       		 clonedgui.TextLabel.TextColor3 = Color3.fromRGB(231,206,12)
        	clonedgui.TextLabel.TextTransparency = 1 
      		  wait(1)
		clonedgui:Destroy()
    end

Many errors in this script:

-You had an "if player.name = "" then". This means that it will always be false because it is impossible for a player to be named that. This is also why you received no errors.

-The variable stats was not defined, so I did it for you.

-I added a Leaderboard for you :)

You can edit this. I hope you have fun with this script! Comment if you have errors.

Best,

TheLastHabanero

6 comments

0

I don't know why but is not working. This part is for the leaderboard right? "local stats = Instance.new("Folder",player) stats.Name = "leaderstats" local Money = Instance.new("IntValue",stats) Money.Name = "Money""

0

Error: (18,1) Expected 'end' (to close 'function' at line 2), got

0

Add an"end)" at the end

0

Still not working. If i want to the script activate when the player money increase than i will need to use IntValue.Changed?

0

Yes you will.

0

Yes you will.

This discussion is preserved as it was. New answers, comments, and votes are closed.