I want to determine how far the player is from the ground and detect their peak maxheight. I am trying to do this by detecting the rootpart's position and subtracting it by a part on the grounds position. I think the problem is that the two values are not comparing correctly, any help?
distanceBool.Changed:Connect(function() if distanceBool.Value then while task.wait() do local groundPart = game.Workspace.ground local currentHeight = (character.HumanoidRootPart.Position.Y - groundPart.Position.Y) local maxHeight = 0 if currentHeight > maxHeight then maxHeight = currentHeight end if not distanceBool.Value then break end print(maxHeight,"maxHeight") end end end)