I’m just starting to create a new game and I’ve ran into a problem already. I’m not sure how to explain it but my billboard is ‘lagging’ or following my character’s trail instead of being at the exact position I want.
Video:
Script:
local Players = game:GetService("Players")
local Billboard = game:GetService("ServerStorage"):WaitForChild("BillboardPart")
Players.PlayerAdded:Connect(function(Player)
local character = Player.Character or Player.CharacterAdded:Wait()
local leaderstats = Instance.new("Folder", Player)
local StepsValue = Instance.new("NumberValue", leaderstats)
local NewBillboard = Billboard:Clone()
NewBillboard.BillboardGui.PlayerName.Text = Player.Name.." has"
NewBillboard.Parent = workspace
game:GetService("RunService").Heartbeat:Connect(function()
NewBillboard.BillboardGui.steps.Text = StepsValue.Value
NewBillboard.Position = character.Head.Position + Vector3.new(0,2,0)
end)
end)
script.LocalScript:Clone().Parent = game.StarterPlayer.StarterCharacterScripts
local Players = game:GetService("Players")
local Billboard = game:GetService("ServerStorage"):WaitForChild("BillboardPart")
Players.PlayerAdded:Connect(function(Player)
local character = Player.Character or Player.CharacterAdded:Wait()
local leaderstats = Instance.new("Folder", Player)
local StepsValue = Instance.new("NumberValue", leaderstats)
local NewBillboard = Billboard:Clone()
NewBillboard.BillboardGui.PlayerName.Text = Player.Name.." has"
NewBillboard.Parent = workspace
NewBillboard.Name = Player.Name .. "'s Billboard"
game:GetService("RunService").Stepped:Connect(function()
NewBillboard.BillboardGui.steps.Text = StepsValue.Value
Billboard.Position = game.Players.LocalPlayer.Character.Head.Position + Vector3.new(0,2,0) -- I added this so other players will see your billboard.
end)
end)
Put this as a LocalScript parented into the server script
I tested this for a little bit and it does not have any delay.
Edit - I added the same thing for the server so other players will see your billboard, but for other players it will be laggy like the original. Some solutions for the server would be welding it to the player’s head, and trying a while true do wait(). I think the best solution would be welding it to the player’s head and moving the position of it up a little bit.
I edited my original post so you can try the new code and if it’s still not what you want then you could try the other suggestions I put at the bottom where it says "Edit - "