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

Trying to make an overhead and it's not working. Why does it only do this?

So basically I'm trying to make an overhead GUI for a player when they join and their bounty equals >= 100 it shows a player's name in green and vice versa when its <= 100 their overhead text turns red

It works so far however, if their bounty is over 100 it's still green; please help

local billboardGui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")

game.Players.PlayerAdded:Connect(function(player)
	
	player.CharacterAdded:Connect(function(character)
		
		if player.Stats.Bounty.Value >= 0 then
			local clonedgui = billboardGui:Clone()
			clonedgui.TextLabel.Text = "Player: " .. player.Name
			clonedgui.TextLabel.TextColor3 = Color3.fromRGB(36,154,136)
			clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head
		end
		
		if player.Stats.Bounty.Value <= 100 then
			if character.Head:FindFirstChild("BillboardGui") then
				
			else
				local clonedgui = billboardGui:Clone()
				clonedgui.TextLabel.Text = "Player: " ..player.Name
				clonedgui.TextLabel.TextColor3 = Color3.fromRGB(255,0,0)
				clonedgui.Parent = game.Workspace:WaitForChild(player.Name).Head 
			end
		end
	end)
end)

2 comments

0

At line 7 you're checking if the Value is equal to or greater than 0. I think you meant to check if its equal to or greater than 100?

0

Well, I'm trying to make that statement turn the textlabel green because I want any players with 0 or less bounty to be green.

1 answer

Here's a code sample.

PLAYER.Stats.Bounty.Changed:connect(function(change) --i assume its an intvalue
	if (PLAYER.Stats.Bounty.Value >= 100 ) then
		clonedGui.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
	else
		clonedGui.TextLabel.TextColor3 = Color3.fromRGB(0,255,0)
	end
end)

Was this what you were looking for?

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