local plrchar = game.Players.LocalPlayer.Character local players = game.Players:GetChildren() local function findplayers() for i,v in pairs(players)do wait(1) local pc = game.Workspace:FindFirstChild(v.Name) if v.TempPlayerStatsModule.IsBeast.Value == true then local atta = Instance.new("Attachment",plrchar.Torso) local atta2 = Instance.new("Attachment",pc.Torso) atta2.Parent = pc.Torso local beam = Instance.new("Beam",plrchar.Torso) beam.FaceCamera = true beam.Attachment0 = atta beam.Attachment1 = atta2 beam.Color = ColorSequence.new(Color3.fromRGB(255,0,0)) local billboard = Instance.new("BillboardGui",beam) billboard.Size = UDim2.new (0,200,0,50) billboard.ExtentsOffset = Vector3.new(0,2.5,0) billboard.AlwaysOnTop = true billboard.Adornee = pc.Head wait(.1) local textbox = Instance.new ("TextBox",billboard) textbox.Size = UDim2.new (0, 200,0, 50) textbox.Name = "textbox" wait(.1) textbox.TextColor3 = Color3.fromRGB(255,0,0) textbox.TextSize = 20 textbox.BackgroundTransparency = 1 textbox.Text = "It" elseif v.TempPlayerStatsModule.IsBeast.Value == false then local atta = Instance.new("Attachment",plrchar.Torso) local atta2 = Instance.new("Attachment") atta2.Parent = pc.Torso local beam = Instance.new("Beam",plrchar.Torso) beam.FaceCamera = true beam.Attachment0 = atta beam.Attachment1 = atta2 beam.Color = ColorSequence.new(Color3.fromRGB(0,255,0)) local billboard = Instance.new("BillboardGui",beam) billboard.Size = UDim2.new (0,200,0,50) billboard.ExtentsOffset = Vector3.new(0,2.5,0) billboard.AlwaysOnTop = true billboard.Adornee = pc.Head wait(.1) local textbox = Instance.new ("TextBox",billboard) textbox.Size = UDim2.new (0, 200,0, 50) textbox.Name = "textbox" wait(.1) textbox.TextColor3 = Color3.fromRGB(0,255,0) textbox.TextSize = 20 textbox.BackgroundTransparency = 1 textbox.Text = "Other" end end end
It says that pc (the players character) is nil about 10% of the time when creating the billboard gui. Why is this?
I have also tried v.Character for [pc]
Add
repeat wait() until game.Players.LocalPlayer.Character
at the beginning of the script.
The console is saying it's nil sometimes because the script is running before the character loads in