Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a distance from part GUI?

1 answer

Just like the comment says, you would use magnitude!

local p1 = game.Workspace.Part1.Position
local p2 = game.Workspace.Part1.Position

local distanceBetweenThem = (p1-p2).magnitude

As for having a gui update when the player moves, I would recommend using the .Changed property which can be found in all Instances.

local part = playerCharacter:WaitForChild("HumanoidRootPart")
part.Changed:connect(function()
	--then simply apply the distance code I gave you to this
end)

1 comment

0

Still confused on where I put those scripts, could you tell me?

This discussion is preserved as it was. New answers, comments, and votes are closed.