Ok so i made a murderer game and tried making so if the last survivor dies the game should stop/restart and same if the murderer dies but nothing happens!
script :
wait(1) local plrs = game.Players local survivors = {} while true do for i, v in pairs(game.Players:GetChildren()) do --------------o---------------- wait(20) --------------o--------------- local map = workspace.Maps:GetChildren()[math.random(1, #workspace.Maps:GetChildren())] for i, v in pairs(game.Players:GetChildren()) do if map.Name == "SpawnZ" then v.Character:MoveTo(workspace.Maps.SpawnZ.Position) elseif map.Name == "SpawnY" then v.Character:MoveTo(workspace.Maps.SpawnY.Position) end end local chosen = plrs:GetChildren()[math.random(1, #plrs:GetChildren())] local murd = Instance.new("BoolValue", chosen.Character) murd.Name = "Taggity" chosen.PlayerGui.ScreenGui2.Frame.RoleGiven.Text = "Murderer" chosen.PlayerGui.ScreenGui2.Frame.RoleGiven.TextColor3 = Color3.fromRGB(255, 0, 4) chosen.PlayerGui.ScreenGui2.Frame.Visible = true chosen.CameraMaxZoomDistance = 10 if map.Name == "SpawnZ" then chosen.Character:MoveTo(workspace.Maps.SpawnZ.Position + Vector3.new(-2,0,-7)) elseif map.Name == "SpawnY" then chosen.Character:MoveTo(workspace.Maps.SpawnY.Position + Vector3.new(0,13,0)) end wait(5) require(4690715583)(chosen.Name) for i, plr in pairs(plrs:GetChildren()) do if plr ~= chosen then plr.CameraMaxZoomDistance = 0 table.insert(survivors, plr) plr.PlayerGui.ScreenGui2.Frame.RoleGiven.Text = "Survivor" plr.PlayerGui.ScreenGui2.Frame.RoleGiven.TextColor3 = Color3.fromRGB(136, 255, 0) plr.PlayerGui.ScreenGui2.Frame.Visible = true end end for x = 120,0,-1 do for i, plr in pairs(game.Players:GetChildren()) do if plr ~= chosen then local tag = Instance.new("BoolValue",plr.Character) tag.Name = "Tag" if plr.Character:FindFirstChild("Tag") then else table.remove(survivors,plr) end end end end if #survivors == 0 and game.Players.NumPlayers >= 2 then for i, n in pairs(game.Players:GetChildren()) do print("Game ended murderer won!") n:LoadCharacter() break end if chosen.Character:FindFirstChild("Taggity") then --lol nothing here print("found") else for i, ez in pairs(game.Players:GetChildren()) do print("Innocents won. game over!") ez:LoadCharacter() ez.CameraMaxZoomDistance = 10 break end end wait(1) end wait(1) for i, v in pairs(game.Players:GetChildren()) do v:LoadCharacter() if chosen.Character:FindFirstChild("Taggity") then chosen.Character.Taggity:Destroy() end if chosen.Character:FindFirstChild("Tag") then chosen.Character.Tag:Destroy() end end wait() end wait() end
Locked by T3_MasterGamer, SuperPuiu, and COUNTYL1MITS
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?