local part = script.Parent
warn(game.Players:GetPlayers())
local GASDAMAGEFROMGAS_DISTANCE = (part.Position - game.Players:GetPlayers().Character:WaitForChild(“HumanoidRootPart”).Position).magnitude
while wait() do
if GASDAMAGEFROMGAS_DISTANCE < 50 then
end
end
My problem: How do I reach the player(s) who is in range it?
local part = script.Parent
local players = game:GetService('Players') -- always use :GetService on services (except workspace)
for i,v in pairs(players:GetPlayers()) do
coroutine.wrap(function() -- we need to create a separate thread, otherwise it'll be stuck on one player
while true do
local character = v.Character or v.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild('HumanoidRootPart')
if (part.Position - humanoidRootPart.Position).Magnitude <= 50 then
-- this is where you'd go with the conditional if statement
end
wait()
end
end)()
end