------------------------- -- Picks random killer -- ------------------------- players = game.Players:GetChildren() randomp = players[math.random(#players)] print(randomp.Name .. " is killer") for i,v in pairs(players) do if v.Name ~= randomp.Name then print(v.Name .. " is runner") end end --------------------------------- -- Teleport players to the map -- --------------------------------- spawns = mapChosenClone.Spawns:GetChildren() for i,v in pairs(game.Players:GetChildren()) do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid then check:MoveTo(spawns[i].Position) end end end
Ok so what I have the script do is pick 1 random player to be a killer and the rest are runners. I need the Teleport part of the script to teleport the runners to a certain brick and the killer to another brick, like deathrun. Could I insert a BoolValue or stringvalue, that when the Killer is chosen they get a boolvalue and then tps the killer to a certain block within the map. Anyone know what I am doing wrong?
You don't really need to waste space with that, just set the value using the script. Try this:
------------------------- -- Picks random killer -- ------------------------- players = game.Players:GetChildren() randomp = players[math.random(#players)] print(randomp.Name .. " is killer") for i,v in pairs(players) do if v.Name ~= randomp.Name then print(v.Name .. " is runner") killer = v.Name end end --------------------------------- -- Teleport players to the map -- --------------------------------- spawns = mapChosenClone.Spawns:GetChildren() for i,v in pairs(game.Players:GetChildren()) do name = v.Name check = game.Workspace:FindFirstChild(name) if check then checkHumanoid = check:FindFirstChild("Humanoid") if checkHumanoid and name ~= killer then -- name is the name of the player, yes? check:MoveTo(spawns[i].Position) elseif checkHumanoid and name == killer then check:MoveTo() -- Dont forget to put in the coordinates. I dont know where the spawn is. end end end