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

[SOLVED] Why isn't the BillboardGUI going into Roblox Premium subscribers?

Asked by
Hypoxla 125
4 years ago
Edited 4 years ago

Script Output:

ServerScriptService.Script:7: attempt to index nil with 'MembershipType

**Script: **

local overhead = game:GetService("ServerStorage"):WaitForChild("OverheadGUI");
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local plr = player.Character
local clonedgui = overhead:Clone();
local clonedTextL = clonedgui.ImageLabel;

if player.MembershipType == Enum.MembershipType.Premium then
    clonedgui.Parent = game.Workspace:WaitForChild(plr.Name).Head;

end


The script is in ServerScriptService.

0
Not sure why the Codeblock created an extra line after LINE 01. Hypoxla 125 — 4y

1 answer

Log in to vote
0
Answered by
MemezyDev 172
4 years ago

Why is there a local script in ServerScriptService. I tested with the membership thing and it worked for me, but assuming from your player variable, you are cloning on the client. This means that the ui is being sent on the client. If you are using a server script, then LocalPlayer is invalid. A correction to this is:

local overhead = game:GetService("ServerStorage"):WaitForChild("OverheadGUI")
local clonedgui = overhead:Clone()
local clonedTextL = clonedgui.ImageLabel

game.Players.PlayerAdded:Connect(function(player)
    wait()
        if player.MembershipType == Enum.MembershipType.Premium then
            clonedgui.Parent = workspace:WaitForChild(player.Name).Head 
    end
end)

please make sure that the above script is in a server script. Please accept if it works for you!

0
The script works when the player joins, but when they die or get re spawned, the BillboardGUI disappears. Hypoxla 125 — 4y
Ad

Answer this question