Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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!

0
Debug AswormeDorijan111 531 — 5y
0
have you tried doing this on line 12? if (players.UserId == tonumber(v)) then XviperIink 428 — 5y
0
Tried that, same result. NitrousGalaxy 9 — 5y

3 answers

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
5 years ago
Edited 5 years ago
--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.

0
so this does not seem to do anything though im sure this is a step in the right direction NitrousGalaxy 9 — 5y
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. pwx 1581 — 5y
0
Still does not work and there is no errors. I am clueless on what to do. NitrousGalaxy 9 — 5y
0
Is the BillboardGui enabled? Also, make sure the BillboardGui frames are also visible (so when parents, you can actually see it). pwx 1581 — 5y
Ad
Log in to vote
0
Answered by
G2001H 75
5 years ago

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
0
Does not work at all. NitrousGalaxy 9 — 5y
0
for me work... G2001H 75 — 5y
0
You use LocalScript? G2001H 75 — 5y
0
Tell me errors from Output when u test the game G2001H 75 — 5y
View all comments (2 more)
0
I used local script and there are no errors at all. NitrousGalaxy 9 — 5y
0
idk for me work i test in studio btw add your id in Visitors G2001H 75 — 5y
Log in to vote
0
Answered by 5 years ago

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

0
might want to use a code block next time XviperIink 428 — 5y
0
Does not seem to do anything, no errors. I am using local script NitrousGalaxy 9 — 5y

Answer this question