local plrC = 0
local function gamestart()
print("Yes")
for keyvalue, player in pairs(game.Players:GetPlayers()) do
local num = math.random(1,5)
if game.Workspace.Seats:FindFirstChild(num).Value.Value == "None" then
game.Workspace.Seats:FindFirstChild(num).Value.Value = player.Name
game.Workspace.Seats:FindFirstChild(num):Sit(player.Character.Humanoid)
game.Workspace:WaitForChild("GameStarted").Value = true
local PlayerNumberSeat = Instance.new("NumberValue")
PlayerNumberSeat.Parent = player.Character
PlayerNumberSeat.Value = num
end
end
end
game.Workspace.GameStarted.Changed:Connect(function()
if game.Workspace.GameStarted.Value == true then
local playerService = game:GetService("Players")
local Players = playerService:GetPlayers()
local RandomPlayer = Players[math.random(#Players)]
game.ReplicatedStorage.PickPlayer:FireClient(RandomPlayer)
local RandomPlayerWork = game.Workspace:FindFirstChild(RandomPlayer.Name)
local WeaponAim = game.ServerStorage.LocalLookingAroundScript:Clone()
WeaponAim.Disabled = false
WeaponAim.Parent = RandomPlayerWork
print(RandomPlayer.Name)
local gun = game.ServerStorage.Deagle:Clone()
gun.Parent = RandomPlayerWork
game.ReplicatedStorage.PickPlayer:FireClient(RandomPlayer)
game.ReplicatedStorage.PickPlayer.OnServerEvent:Connect(function()
local SeatNumber = RandomPlayerWork.Value.Value
SeatNumber = SeatNumber + 1
local playerName = game.Workspace.Seats:FindFirstChild(SeatNumber).Value.Value
print(playerName)
SeatNumber = SeatNumber - 1
print(playerName)
local Nextplayer = game.Workspace:FindFirstChild(playerName)
local WeaponAim = game.ServerStorage.LocalLookingAroundScript:Clone()
WeaponAim.Disabled = false
WeaponAim.Parent = Nextplayer
print(RandomPlayer.Name)
local gun = game.ServerStorage.Deagle:Clone()
gun.Parent = Nextplayer
end)
local function PlayerCountChecker()
print("Yes")
if plrC >= 2 then
game.ReplicatedStorage.Intermisson:FireAllClients()
wait(6.5)
gamestart()
elseif plrC <= 1 then
game.ReplicatedStorage.NotEnoughPlayers:FireAllClients(plrC)
end
local function PlayerAdded()
plrC = plrC + 1
PlayerCountChecker()
end
game.Players.PlayerAdded:Connect(PlayerAdded)
for i,v in next,game.Players:GetPlayers() do
PlayerAdded()
end
game.Players.PlayerRemoving:Connect(function()
plrC = plrC - 1
PlayerCountChecker()
end)
end
end
end)
COMMUNITY QUESTION
I don't know whats wrong it was working before in the script most of functions are working?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
Can you please elaborate more? What did you try? What is the error and which line is it in?
Theres no errors the Playeradded function is not working
Try adding some prints in there
It doesnt fire cus the functions dont work