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 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)