A continuation of this thread, now that my problem’s a bit different.
I have a script set up to make a BillboardGui and parent it to the player’s head when they join. However, it just doesn’t create either at all. I’ve looked at similar “Instance.new isn’t working” threads with this same exact issue, and I appear to be doing everything right…
I have no scripts that reparent or delete this BillboardGui, and this script used to work just fine!
The Player and Character being added also aren’t the issue, I’ve already done print tests for these.
im almost 100% certain instance.new isnt the issue. Because you would get an error when trying to set its name or parent since you cant set the parent of a nil value.
BillboardGui.Adornee = Instance
You’ve forgotten to assign the billboard’s ‘Adornee’ property (which specifies what physical instance the interface should be cast from). This property should default to the billboard’s parent however.
local Game = game
local Players = Game:GetService("Players")
local function OnPlayerAdded(Player)
local function OnCharacterAdded(Character)
if not Player:HasAppearanceLoaded() then
Player.CharacterAppearanceLoaded:Wait()
end
local Head = Character:WaitForChild("Head")
local BillboardGui = Instance.new("BillboardGui")
BillboardGui.Adornee = Head
BillboardGui.Parent = Head
end
Player.CharacterAdded:Connect(OnCharacterAdded)
end
Players.PlayerAdded:Connect(OnPlayerAdded)
For my own reference, revised version of the script:
local Game = game
local Players = Game:GetService("Players")
local function OnPlayerAdded(Player)
local function OnCharacterAdded(Character)
if not Player:HasAppearanceLoaded() then
Player.CharacterAppearanceLoaded:Wait()
end
local Head = Character:WaitForChild("Head")
local nameGui = Instance.new("BillboardGui")
nameGui.StudsOffset = Vector3.new(0, 3, 0)
nameGui.Size = UDim2.new(0, 200, 0, 50)
nameGui.Name = "BioGui"
nameGui.Adornee = Head
nameGui.Parent = Head
nameGui.MaxDistance = 100
local nameLabel = Instance.new("TextLabel")
nameLabel.Text = "-"
nameLabel.TextScaled = true
nameLabel.TextWrapped = true
nameLabel.Size = UDim2.new(.5, 100, 0, 25)
nameLabel.BackgroundTransparency = 1
nameLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
nameLabel.Font = 4
nameLabel.TextStrokeColor3 = Color3.new(0, 0, 0)
nameLabel.TextStrokeTransparency = .5
nameLabel.Name = "BioLabel"
nameLabel.Parent = nameGui
end
Player.CharacterAdded:Connect(OnCharacterAdded)
end
Players.PlayerAdded:Connect(OnPlayerAdded)