here is my issue I am trying to get two guys to do whats in the while loop. which is to follow the player and to return to their spawn, but i cant seem to get this right.. I just made this script in this for an example.. Please help!
local h = game.Workspace.guy1.Humanoid
local b = game.Workspace.guy2.Humanoid
local UpperTorso = game.Workspaceguy1.UpperTorso
local UpperTorsoA = game.Workspace.guy2.UpperTorso
local spawnCF = UpperTorso.CFrame
local spawnCFA = UpperTorsoA.CFrame
function findPlayer()
for _,v in next, game.Players:GetPlayers() do
if v.Character then
local char = v.Character
if char:FindFirstChild("Humanoid") and char:FindFirstChild("UpperTorso") then
local pUpperTorso = char.UpperTorso
if (pUpperTorso.Position - UpperTorso.Position).magnitude <= 30 then
else h = nil
if (pUpperTorso.Position - UpperTorsoA.Position).magnitude <= 30 then
else b = nil
return v
end
end
end
end
end
return nil
end
while wait() do
local player = findPlayer()
if player ~= nil then
if h ~= nil then
h.WalkToPoint = player.Character.UpperTorso.Position
else
if b ~= nil then
b.WalkToPoint = player.Character.UpperTorso.Position
else
h.WalkToPoint = spawnCF.p
b.WalkToPoint = spawnCFA.p
end
end
end
end

4 comments
indentation 10/10
I think the funky indentation is roblox's fault this time
You have to put something in an if statement, you can't write "then else"
If you only want something to run if a condition is NOT true, you can write "if not (yourconditional) then"