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.
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!