For some reason this script teleports the players but not the seeker?
I have a Folder inside the map named SeekerSpawns which is where I want the seeker to spawn.
TeleportPlayers Function:
local function TeleportPlayers(AvailablePlayers, Spawns)
for _, Player in pairs(AvailablePlayers) do
if Player.Character then
if Player.Character:FindFirstChild("HumanoidRootPart") then
Player.Character.HumanoidRootPart.CFrame = Spawns[math.random(1, #Spawns)].CFrame + Vector3.new(0, 5, 0)
end
end
end
end
Also, since Player is a part of the AvailablePlayers table, and not of game.Players:GetChildren(), you cant get their character like that, you’ll need to find their character in workspace
local function TeleportPlayers(AvailablePlayers, Spawns)
for _, Player in pairs(AvailablePlayers) do
--if we found the character of that Seeker, in workspace - then
if game.Workspace:FindFirstChild(Player) then
if game.Workspace:FindFirstChild(Player):FindFirstChild("HumanoidRootPart") then
game.Workspace:FindFirstChild(Player).HumanoidRootPart.CFrame = Spawns[math.random(1, #Spawns)].CFrame + Vector3.new(0, 5, 0)
end
end
end
end
--Calling the function--
TeleportPlayers({"NameHere"}, Map.SeekerSpawns:GetChildren())