For some reason, my script's magnitude doesn't work, "elseif" errors but I'm not sure why, and I don't know how to fix that, when I play is all it does is prints ("Found") and it doesn't check the new position for some reason, any help?
local part = game.Workspace.Part2
local billboard = game.Workspace.BillBoardPart.BillboardGui.TextLabel
local cas = game:GetService("ContextActionService")
local function onpress(action1)
part.BrickColor = BrickColor.new("Black")
end
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humRoot = character:WaitForChild("HumanoidRootPart")
while (part.Position - humRoot.Position).Magnitude > 10 do
wait(1)
billboard.Visible = true
print("found")
cas:BindAction("action1", onpress, true, "t")
end
elseif (part.Position - humRoot.Position).Magnitude < 10 do
wait(1)
billboard.Visible = false
print("didnt find")
cas:UnbindAction("action1")
end

4 comments
You can't do while and elseif, there has to be a starting if somewhere. As I know of.
Magnitude shouldn't be capitalized. (I don't know if this is true, but maybe give it a shot)
@Aeroporia Yes it can be capitalized, that's not the issue.
OHH