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

How do i create an overhead gui?

I am trying to make a over head gui so if someone picks a team the team name will be over there head and on the game leaderboard this is what i got atm

valor = game.StarterGui.Choose.Frame.Valor
mystic = game.StarterGui.Choose.Frame.Mystic
instinct = game.StarterGui.Choose.Frame.Instinct
remove = game.StarterGui.Choose


game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
	wait(1)
	if
		valor.clickedon then do
		   gui = Instance.new("BillboardGui")
		   gui.Parent=newPlayer.Character.Head
		   gui.Adornee=newPlayer.Character.Head
		   gui.Size=UDim2.new(3,0,2,0)
		   gui.StudsOffset=Vector3.new(0,2,0)
		   words = Instance.new("TextLabel")
		   words.Text = Team Valor
		   words.Position=UDim2.new(-0.125,0,-0.25,0)
		   words.BackgroundTransparency = 1
		   words.Parent=gui
		   wait(1)
		   valor.Visible = Disable
		end
	end
end

function onPlayerEntered(newPlayer)
	newPlayer.Changed:connect(function (property)
		if (property == "Character") then
			onPlayerRespawned(newPlayer)
		end
	end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)

Please can you fix it c;

1 comment

0

Can you include some infomation about the problem?

1 answer

Well, you have a rogue event connection on line 7 which is both above the target function (so it errors due to onPlayerRespawned not being a function, as it is nil). Remove that line.

On line 11 you are (I assume) attempting to check if the player has clicked on the object valor. There are a number of issues with this:

1: There is no clickedon property. You want to use events. 2: This is going to probably be a server-Script, and you don't get user input from a server-Script (you use a LocalScript for that) 3: valor is the UI element in the StarterGui, which is not the same as what the players see (they see a clone of the contents of StarterGui)

You also have a syntax error on line 18 (words.Text = Team Valor). Strings (text) needs to be enclosed in single quotes ('), or double quotes (") or (rarely) double brackets ([[ and ]]). Use words.Text = "Team Valor" instead.

On line 23 you are attempting to assign Disable to valor.Visible. This is a boolean property, so you should pass in either true or false. Also, valor is inside StarterGui, and as such any modifications to it will only affect players who respawn.

Also, you don't need do with if. All you are doing is creating an unnecessary code block. And use Player.CharacterAdded instead of Player.Changed for detecting respawning.

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