I have this part in my game script where it's supposed to call he "HandleDuelers" function on both of the duelers, but it's only handling one. I'm not sure why this is because I have the perimeters matched up to my knowledge. If you know how to fix this, I would be very grateful.
local function HandleDuelers(Dueler) local Spawns = Map:FindFirstChild("Spawns"):GetChildren() local RandomSpawn = table.remove(Spawns, math.random(1, #Spawns)) Dueler.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(RandomSpawn.Position + Vector3.new(0, 3, 0)) local Sword = ServerStorage:FindFirstChild("Sword"):Clone() Sword.Parent = Dueler.Backpack end local PossiblePlayers = Players:GetPlayers() local Player1 = PossiblePlayers[math.random(1, #PossiblePlayers)] repeat Player2 = PossiblePlayers[math.random(1, #PossiblePlayers)] wait(1) until Player2 ~= Player1 HandleDuelers(Player1, Player2)
This is because your function can only take in 1 parameter. For example, this would not print "Hello world!"
function something(info) print(info) end something('Hello', ' world!')
You would have to do
function something(info, more) print(info, more) end something('Hello', ' world!')
For your case, your script would be
local function HandleDuelers(Dueler, SecondDueler) for _, Dueler in pairs({Dueler, SecondDueler}) do local Spawns = Map:FindFirstChild("Spawns"):GetChildren() local RandomSpawn = table.remove(Spawns, math.random(1, #Spawns)) Dueler.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(RandomSpawn.Position + Vector3.new(0, 3, 0)) local Sword = ServerStorage:FindFirstChild("Sword"):Clone() Sword.Parent = Dueler.Backpack end end local PossiblePlayers = Players:GetPlayers() local Player1 = PossiblePlayers[math.random(1, #PossiblePlayers)] repeat Player2 = PossiblePlayers[math.random(1, #PossiblePlayers)] wait(1) until Player2 ~= Player1 HandleDuelers(Player1, Player2)
Hope this helps!