Ive used a find nearest torso script and edited it, but it wont do anything. No output in the script analysis
local larm = script.Parent:FindFirstChild("Left Arm") local rarm = script.Parent:FindFirstChild("Right Arm") local human = nil function findNearestTorso(pos) local list = game.Workspace:children() local torso = nil local dist = 30 local temp = nil local temp2 = nil for x = 1, #list do temp2 = list[x] if (temp2.className == "Model") and (temp2 ~= script.Parent) and game.Players:GetPlayerFromCharacter(temp2)~=nil then temp = temp2:findFirstChild("Right Arm") human = temp2:findFirstChild("Humanoid") if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then if (temp.Position - pos).magnitude < dist then torso = temp dist = (temp.Position - pos).magnitude end end end end return torso end while true do wait() local target = findNearestTorso(script.Parent.Torso.Position) if target ~= nil then human:TakeDamage(10) end end
Closed as Non-Descriptive by iluvmaths1123 and BlueTaslem
This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.
Why was this question closed?