My script doesn’t seem to print this line every Heartbeat
print(player, Distance)
It prints all the other prints rapidly, but not the above print. The only way I can get it to print is if the local player moves.
-- Update the PlayerLabel positions
local function Update()
if TotalSize <= 0 then return end
print(TotalSize) -- Keeps printing
for _, player in pairs(Players:GetPlayers()) do
print(1) -- Keeps printing
if player.Character and player.Character:FindFirstChild('HumanoidRootPart') then
print(2) -- Keeps printing
local PlayerLabel = PlayerList:FindFirstChild(player.Name)
if not PlayerLabel then
-- Create label
PlayerLabel = CreateLabel(player)
end
-- Calculate players distance
local Distance = player.Character.HumanoidRootPart.Position.Y - Start.Floor.Position.Y - 2
if player ~= Player then
print(player, Distance) -- ONLY prints when MY player moves
end
-- Set position
PlayerLabel.Position = UDim2.new(0, 0, 1 - (Distance / TotalSize), 0)
if Highest > Distance then return end
Highest = Distance
-- Set player's highest progress
local ProgressLine = Frame:FindFirstChild('Progress')
if not ProgressLine then return end
ProgressLine.Visible = true
-- Set progress line position
ProgressLine.Position = UDim2.new(0, 0, 1 - (Highest / TotalSize), 0)
end
end
end
-- Update
RunService.Heartbeat:Connect(Update)