well by this I mean how can I find the player in game.Players if I’m using a range of distance, I already tried but it won’t let me and I don’t know the answer.
local function DistanceToEnabled(plr)
local target = nil
local Range= 15
for i, Dis in pairs(workspace:GetChildren()) do
local Human = Dis:FindFirstChild("Humanoid")
local Torso = Dis:FindFirstChild("UpperTorso")
if Human and Torso and Dis ~= script.Parent then
if (RangeTronco.Position - Torso.Position).magnitude < Range then
Range = (RangeTronco.Position - Torso.Position).magnitude
target = Torso.Position
plr = Dis--According to me, this is to track the player
local player = Players:FindFirstChild(plr)
local Backpack = player:FindFirstChild("Backpack")--Here it gives me the error
end
end
end
end
this was what I tried but it only gave me the error of “Argument 1 missing or nil”, the name does find it but does not let me apply it when looking for the player in game.Players