hello, i'm making a game where one person will be killer and kill the others, and i'm done with the scripting, but after it has looped through the script once it just skips the rest of it and goes on with line 67. also i haven't gotten any error

Please help. here's the script:

local ReplicatedStorage = game:GetService("ReplicatedStorage") local ServerStorage = game:GetService("ServerStorage") local iamcool = true local Maps = ServerStorage:WaitForChild("Maps"):GetChildren() local Status = ReplicatedStorage:WaitForChild("Status") local PLA = game:GetService("Players") while iamcool do while #PLA:GetPlayers() < 3 do PLA.PlayerAdded:Wait() Status.Value = "You need 3 or more Players to play this game" end local countdown = 10 repeat wait(1) countdown = countdown - 1

	Status.Value = "Game is starting in".. countdown
until countdown <= 0

--[[ every second it gets lower! and the status will change to the countdown --]]
wait(2)
Status.Value = "Choosing A Map!"
local randomMap = Maps[math.random(1, #Maps)]
local Spawns = randomMap:WaitForChild("Spawns"):GetChildren()
local randomspawn = Spawns[math.random(1, #Spawns)]
local ThePlayers = game.Players:GetPlayers()
local randomPlayer = ThePlayers[math.random(1, #ThePlayers)]
wait(4)
Status.Value = "Map Has Been Chosen!"
wait(3)
Status.Value = "Choosing Killer"
	wait(3)
Status.Value = randomPlayer.Name.." Has Been Chosen as the Killer"
wait(2)
for _, Player in pairs(ThePlayers) do
	if Player.Character and Player.Character:FindFirstChild('Humanoid') then
		Player.Team = game.Teams.Victims
	end
end

		wait(0.001)
	Status.Value = "Teleporting Players"
		wait(2)
		if game.Workspace.alanwalke.IsPlaying == true then
			game.Workspace.alanwalke:Pause()
		end
		for _, Player in pairs(ThePlayers) do
			if Player.Character and Player.Character:FindFirstChild('Humanoid') then
				local MapClone = randomMap:Clone()
				MapClone.Parent = game.Workspace
				for _, Player in pairs(ThePlayers) do
			if Player.Character and Player.Character:FindFirstChild('Humanoid') then
				wait(0.001) 
				Player.Character.Head.CFrame = randomspawn.CFrame
			end
		end
		
						wait(0.001)
		randomPlayer.Team = game.Teams.Killers
		
	randomPlayer.Character.Head.CFrame = game.Workspace.KillerSpawn.CFrame
				wait(1)
		game.Workspace.Lockdown:Play()
		local gamewait = 20
		repeat wait(1)
		gamewait = gamewait - 1
		
		Status.Value = "The Killer Will Be Released In".. gamewait
		until gamewait <= 0
		for _, Player in pairs(ThePlayers) do
			Player.Character.Humanoid.WalkSpeed = 25
		end
		wait(0.001)
				Status.Value = "The Killer are released! Good Luck!"
				randomPlayer.Character.Humanoid.WalkSpeed = 40
				randomPlayer.Character.Humanoid.JumpPower = 100
				game.Workspace.Sound:Play()
				game.Workspace.scary:Play()
		randomPlayer.Character.Head.CFrame = randomspawn.CFrame
		local SwordClone = game.ReplicatedStorage.Sword:Clone()
		SwordClone.Parent = randomPlayer.Backpack
		wait(2)
		local killers = game.Workspace.Killer:GetChildren()
		local gamelength = 10
		repeat wait(1)
		gamelength = gamelength - 1
		
		Status.Value = "The Game is Ending in:".. gamelength
						until gamelength <= 0 
						Status.Value = "The Game just finished! gg!"
						MapClone:Destroy()
						SwordClone:Destroy()
						randomPlayer.Team = game.Teams.Lobby
						local plrs = game:GetService("Players")
						for _, Players in pairs(plrs:GetPlayers()) do
							if Players.Character and Players.Character:FindFirstChild('Humanoid') then
				Players.Character.HumanoidRootPart.Position = game.Workspace.LobbySpawns.SpawnLocation.Position
			end
		end
			end
		end
					end

2 comments

0

actually i checked the output for the 5th time and i got this error: Humanoidrootpart is not a valid member of player3

0

it still doesn't fix the issue tho