I need help knowing why the nearfire bool only goes true when i'm near one of the determined values by the distance.
local function ERROR(text)
warn("ERROR: ",text)
end
while true do
wait(1)
for index, player in pairs(game:GetService("Players"):GetChildren()) do
local character = player.Character
if character == nil then
ERROR("no character for user ", player.Name)
else
local torso = character:FindFirstChild("Torso")
if not torso then
ERROR("no torso in character for user ", player.Name)
else
local torsoposition = torso.Position
for index, instance in pairs(workspace:GetChildren()) do
if string.lower(instance.Name) == "fireplace" then
local distance = (instance.Position - torsoposition).magnitude
if distance <= 10 or distance <= 10 then
player.nearfire.Value = true
else
player.nearfire.Value = false
end
print(distance)
end
end
end
end
end
end
