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

Overhead GUI display guest for those not in group?

Asked by 6 years ago
Edited 6 years ago

I would like to make this script display that the player is a "-guest-" in both the leaderboard and overhead gui if a player isnt in the group. Also, in the overhead gui, how would I make it so the name is also displayed? Example = Randomplayer, -Guest-. The problem is I do not know how. Thanks.

--overhead billboard gui
groupid = 3309505 

game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
    wait(1)
    if newPlayer:IsInGroup(groupid) then
        gui=Instance.new("BillboardGui")
        gui.Parent=newPlayer.Character.Head
        gui.Adornee=newPlayer.Character.Head
        gui.Size=UDim2.new(3,0,1.25,0)
        gui.StudsOffset=Vector3.new(0,3,0)
        texta=Instance.new("TextBox")
        texta.Size=UDim2.new(1,0,1,0)
        texta.BackgroundTransparency = 1
        texta.TextScaled = true
        texta.TextColor3 = Color3.new(255, 255, 255)
        texta.Text = ("- " .. newPlayer:GetRoleInGroup(groupid) .. " -")
        texta.Parent=gui
        w = game.Lighting.WepsGroup:GetChildren()
        for i = 1,#w do
            w[i]:Clone().Parent = newPlayer.Backpack
        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)
---leaderboard
local MarketplaceService = game:GetService("MarketplaceService")
local ProductID = 3309505

local playerLeaderstats = {}

game.Players.PlayerAdded:connect(function(player)

    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local rank = Instance.new("StringValue", leaderstats)
    rank.Name = "Rank"
    rank.Value = player:GetRoleInGroup(3309505) 

    playerLeaderstats[player] = {}
    playerLeaderstats[player]["Cash"] = 100

    local money = Instance.new("IntValue", leaderstats)
    money.Name = "Cash"
    money.Value = playerLeaderstats[player]["Cash"]

    while wait(5) do 
        playerLeaderstats[player]["Cash"] = playerLeaderstats[player]["Cash"] + 1
        if player:FindFirstChild("leaderstats") ~= nil then
            player.leaderstats.Cash.Value = playerLeaderstats[player]["Cash"]
        end
    end

end)

MarketplaceService.ProcessReceipt = function(info)

    -- All of this code is a slighly modified version of the code on the wiki.
    local player = game:GetService("Players"):GetPlayerByUserId(info.PlayerId)
    if not player then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end

    if info.ProductId == ProductID then
        playerLeaderstats[player]["Cash"] = playerLeaderstats[player]["Cash"] + 500
        if player:FindFirstChild("leaderstats") ~= nil then
            player.leaderstats.Cash.Value = playerLeaderstats[player]["Cash"]
        end
    end 

    return Enum.ProductPurchaseDecision.PurchaseGranted 

end
0
I think to make the name display you'd have to make it like this: piRadians 297 — 6y

Answer this question