#waypoint that displays distance

6 messages · Page 1 of 1 (latest)

thin thicket
#

@peak dome

#

see if this works.

#
local waypoint = script.Parent
local gui = waypoint:WaitForChild("BillboardGui")
local label = gui:WaitForChild("TextLabel")
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait() or player.Character

while true do
    local success, distance = pcall(function()
        return workspace:GetDistance(character.PrimaryPart.Position, waypoint.Position)
    end)
    if success then
        print(distance)
        label.Text = "Distance: " .. distance
    end
    wait(1)
end
rugged bolt
#

GetDistance isn't a real method of workspace

#
while true do
    local success, distance = pcall(function()
        return (character.PrimaryPart.Position-waypoint.Position).Magnitude
    end)
    if success then
        print(distance)
        label.Text = "Distance: " .. distance
    end
    wait(1)
end
#

try that instead of your while loop