[SOLVED] BillboardGui text not changing

I am trying to make the text say the distance between the player and the part but it is not working.
Here’s the Script (Note: It’s a Local Script):

local part = script.Parent.Parent

local plr = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()

local char = plr.Character or plr.CharacterAdded:Wait()

local humanoidRootPart = char:WaitForChild("HumanoidRootPart")

local txt = script.Parent:WaitForChild("Distance")

while wait() do
	
	local distance = (part.Position - humanoidRootPart.Position).magnitude
	
	txt.Text = distance
	
end

Any help is appreciated.

Any errors in the output? I believe you might have to capitalize the M for Magnitude.

local part = script.Parent.Parent

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local humanoidRootPart = char:WaitForChild("HumanoidRootPart")

local txt = script.Parent:WaitForChild("Distance")

while wait() do
	
	local distance = (part.Position - humanoidRootPart.Position).Magnitude
	
	txt.Text = distance
	
end

Also, you can’t use LocalScripts in workspace (if that’s where your script is located)

Thank you, I solved it on my own though I forgot to put solved in the title.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.