Hi all, Here's my current script for a Murder Game All the objects referenced are in lighting and used by other working scripts

When I run this, I get no error or anything I commented a bit out to test it on solo

Code /

math.randomseed(tick())

function testPlayerNum()
local counter = 0
	for i,v in pairs(Game.Players:GetChildren()) do
		counter = counter + 1
	end
	if counter >= 3 then
		return true
	else
		return false
	end
end
debounce = false
while wait() do
	if debounce == false then
	if testPlayerNum() then
		if Game.Lighting.Stats.GameRunning.Value == false then
			Game.Lighting.Stats.GameRunning.Value = true
			if Game.Lighting.Stats.LobbyTime.Value <= 0 then
				debounce = true
				Game.Lighting.Stats.Sherrif.Value = "None"
					Game.Lighting.Stats.Murderer.Value = "None"
				local map = Game.Lighting.Maps.Office:Clone()
				map.Parent = Game.Workspace
				counter1 = 0
	            for i,v in pairs(Game.Players:GetChildren()) do
		        counter1 = counter1 + 1
	            end
				Game.Lighting.Stats.PlayersOn.Value = counter1
				for i,v in pairs(Game.Players:GetChildren()) do
					local lestat = Instance.new("StringValue",Game.Lighting.CurrPlayers)
					lestat.Name = v.Name
				end
				for i,v in pairs(Game.Players:GetChildren()) do
					if Game.Lighting.CurrPlayers:FindFirstChild(v.Name) then
						v.Character.Humanoid.WalkSpeed = 16
					local randomInt = math.random(10,100)
					if randomInt <= 20 then
						v.Character.Torso.CFrame = CFrame.new(map.MapSpawn1.Position)
						else if randomInt <= 40 then
						v.Character.Torso.CFrame = CFrame.new(map.MapSpawn2.Position)
							else if randomInt <= 60 then
						v.Character.Torso.CFrame = CFrame.new(map.MapSpawn3.Position)
							else if randomInt <= 80 then
						v.Character.Torso.CFrame = CFrame.new(map.MapSpawn4.Position)
							else if randomInt <= 100 then
						v.Character.Torso.CFrame = CFrame.new(map.MapSpawn5.Position)
						
						
					randomInt2 = math.random(30,90)
					if randomInt2 < 30 then
						if Game.Lighting.Stats.Murderer.Value == "None" then
						Game.Lighting.Stats.Murderer.Value = v.Name
					d = Game.Lighting.CurrPlayers:FindFirstChild(v.Name)
								d.Value = "Murderer"
						else if randomInt >= 30 and randomInt < 60 then
							if Game.Lighting.Stats.Sherrif.Value == "None" then
                      d = Game.Lighting.CurrPlayers:FindFirstChild(v.Name)
								d.Value = "Sherrif"
						Game.Lighting.Stats.Sherrif.Value = v.Name
						
							else
								d = Game.Lighting.CurrPlayers:FindFirstChild(v.Name)
								d.Value = "Innocent"
							end
						end
					end
					end
					end
					end
							end
							end
							end
							end
					        end
					
					
					
					
					
					end
				end
				
				
				
				
		        end
	            end
			end
			
			
		
	
	

lol my ends could become ascii art :3

2 comments

0

Do you really think it's wise to make ANOTHER Murder game? Also, please give us a line number.

0

It's not going public, and the lines i commented out are 8,10,11,12