My code is this the name of the script is player finder

local Attacks = require(script.Parent.Attacks)
game.Players.PlayerAdded:Connect(function(plr)
	wait(3)
	plr.CharacterAdded:Connect(function(char)
		local Torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
		local mag = (Torso.Position - script.Parent.UpperTorso.Position)
		while wait() do
			if mag >= 23 then
				if not Attacks:IsPlayerHere(plr.Name) then
	local obj = Instance.new("ObjectValue")
	obj.Value = plr
	obj.Name = plr.Name --Name doesn't matter
	obj.Parent = script.Parent.Players
	end
	end
	end
	end)
end)

it's supposed to add a value to a folder and the module script has a player checking system and returns true or false

local Attacks = {}
function Attacks:IsPlayerHere(plrinquestion)
if script.Parent.Players:FindFirstChild(plrinquestion) then
return true
else
return false
end

is the loop not working for the magnitude?

2 comments

0

(Torso.Position - script.Parent.UpperTorso.Position).magnitude

0

lol fixed