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

Overhead Gui is not working and no errors are being displayed, can anyone see whats wrong with it?

I've been trying to creating an overhead gui without using anything associated with groups or names, just user ids but for some reason this script is not working and no errors are being displayed. Here's the script:

--Variables--
BillboardGui = script.Parent.BillboardGui 

--Settings--
Visitors = {"83997127", "3242545", "3423455"} --Put user ids here that are visitors
EventManagement = {"TESTID", "3242545", "3423455"} --Put the user ids here that are managing the event
MaxOverheadDistance = 25 --Sets how far you can see the overhead gui above players

--Core--
Players.PlayerAdded:Connect(function(players)
	for i, v in pairs(Visitors) do
		if (players.UserId == v) then
			BillboardGui:Clone();
			BillboardGui.Player.Text = player.Name;
			BillboardGui.Position.Text = "Honoured Visitor";
			BillboardGui.MaxDistance = MaxOverheadDistance;
			BillboardGui.Parent = game.Workspace:WaitForChild(players.UserId)
		end
	end
end
--

Any help will be much appreciated!

3 comments

0

Debug

0

have you tried doing this on line 12? if (players.UserId == tonumber(v)) then

0

Tried that, same result.

3 answers

--Main Variables-- 
BillboardGui = script.Parent.BillboardGui

--Services--
Players = game:GetService('Players')

--Settings-- 
Visitors = {83997127, 3242545, 3423455}
EventManagement = {3242545, 3423455}

MaxOverheadDistance = 25

--Core--

function checkUserId(Player)
	for _,v in pairs(Visitors) do
		if type(v) == "number" and v == Player.UserId then
			return 'Honoured Visitor'
		end
	end
	for _,v in pairs(EventManagement) do
			if type(v) == "number" and v == Player.UserId then
				return 'Event Management'
			end
		end
	return nil
end

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local BG = BillboardGui:Clone()
		BG.Parent = Character:WaitForChild('Head')
		BG.Player.Text = Player.Name
		BG.MaxDistance = MaxOverheadDistance;
		if checkUserId(Player) ~= nil then
			BG.Position.Text = checkUserId(Player) 
		end
	end)
end)

I am not entirely sure if this will work, but let me know if any errors come up.

4 comments

0

so this does not seem to do anything though im sure this is a step in the right direction

0

I've noticed also you are trying to parent the billboard in the UserId? I shall recode this for you and change my answer.

0

Still does not work and there is no errors. I am clueless on what to do.

0

Is the BillboardGui enabled? Also, make sure the BillboardGui frames are also visible (so when parents, you can actually see it).

Use LocalScript

local players = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local BillboardGui = script.Parent.BillboardGui
local Visitors = {83997127,3242545,3423455} -- Don't add "" when u use Numbers
local EventManagement = {3242545, 3423455} -- Don't add "" when u use Numbers
local MaxOverheadDistance = 25
wait()
for i, v in pairs(Visitors) do
    if players.UserId == v then
    BillboardGui:Clone().Parent = workspace:FindFirstChild(players.Name).Head
    BillboardGui.Player.Text = players.Name
    BillboardGui.Position.Text = "Honoured Visitor"
    BillboardGui.MaxDistance = MaxOverheadDistance
    end
end

6 comments

0

Does not work at all.

0

for me work...

0

You use LocalScript?

0

Tell me errors from Output when u test the game

0

I used local script and there are no errors at all.

0

idk for me work i test in studio btw add your id in Visitors

Consider changing the beginnings of the constants put 'local' into it.

--Variables-- local BillboardGui = script.Parent.BillboardGui

--Settings-- local Visitors = {"83997127", "3242545", "3423455"} --Put user ids here that are visitors local EventManagement = {"TESTID", "3242545", "3423455"} --Put the user ids here that are managing the event local MaxOverheadDistance = 25 --Sets how far you can see the overhead gui above players

--Core-- game.Players.PlayerAdded:Connect(function(players) for i, v in pairs(Visitors) do if (players.UserId == v) then BillboardGui:Clone(); BillboardGui.Player.Text = player.Name; BillboardGui.Position.Text = "Honoured Visitor"; BillboardGui.MaxDistance = MaxOverheadDistance; BillboardGui.Parent = game.Workspace:WaitForChild(players.UserId) end end end

2 comments

0

might want to use a code block next time

0

Does not seem to do anything, no errors. I am using local script

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