I am making a horizontal tower of hell like bar but when I test it an error pops up saying "attempt to call a nil value". This is the code where the error occurs:
function Update()
for index, Player in next, PlayerLengthData do
local xPosition = Player:GetLengthFromEnd()
Player.Frame.Position = UDim2.new(xPosition, 0, 0.5, 0)
end
end
The error is on line 4. I don't know how to fix this error so please help.

4 comments
How do I know if it returns a value
if your function includes a
returnline then it will return whatever data is to the right of thereturnohh ok
if this solved your problem could you please mark it as the answer?