Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

why is this chat script I made not working? Everything was working when it was seperate.

wait()
game.ReplicatedStorage.Remotes.welcome.OnServerEvent:Connect(function(player)
while true do
if game.Workspace.PlayerCount.Players.Value >= 5
    then
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Waiting for at least FIVE players to join..",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
print("made it here lol")
    })
    wait(10)
    end
wait()
if game.Workspace.PlayerCount.Players.Value <= 5
	and game.Workspace.game.CanCollide == true
	then
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Welcome to the annual HUNGER GAMES",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
    })

	wait(10)
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "If you don't know how to play, read the description!",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
    	})
wait(10)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Selecting random arena...",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
    	})
wait(5)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Arena selected. Prepare to enter the game. May the odds be ever in your favor.",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
    	})
wait(20)
local Pos = player.Character:GetPrimaryPartCFrame()
					player:LoadCharacter()
					player.Character:SetPrimaryPartCFrame(Pos)
					if player.Character:FindFirstChild("ForceField") then
						player.Character["ForceField"]:Destroy()
						wait(1)
						game.Workspace.CanCollide = false
						game.ReplicatedStorage.Remotes.tp:FireServer()
						
						end
end
end
end)

when it was just this part of the script it worked but now it doesnt, any ideas?

wait()
game.ReplicatedStorage.Remotes.welcome.OnServerEvent:Connect(function(player)
while true do
if game.Workspace.PlayerCount.Players.Value >= 5
    then
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Waiting for at least FIVE players to join..",
    Color = Color3.new(100, 100, 0),
    Font = Enum.Font.SourceSansLight,
    FontSize = Enum.FontSize.Size18,
print("made it here lol")
    })
    wait(10)
    end

1 answer

When doing System Messages, you need to use semicolons [ ; ] for tables. You were using a regular comma [ , ].

Example

--this is correct
Text = "heyo";
Font = Enum.Font.SourceSansLight
--

--this isn't
Text = "heyo", --notice the comma
Font = Enum.Font.SourceSansLight

These reason why your script is breaking is because the first System Message broke, breaking all the other ones.

wait()
game.ReplicatedStorage.Remotes.welcome.OnServerEvent:Connect(function(player)
while true do
if game.Workspace.PlayerCount.Players.Value >= 5
    then
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Waiting for at least FIVE players to join..";
    Color = Color3.new(100, 100, 0);
    Font = Enum.Font.SourceSansLight;
    FontSize = Enum.FontSize.Size18;
    })
print("made it here lol")
    wait(10)
    end
wait()
if game.Workspace.PlayerCount.Players.Value <= 5
    and game.Workspace.game.CanCollide == true
    then
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Welcome to the annual HUNGER GAMES";
    Color = Color3.new(100, 100, 0);
    Font = Enum.Font.SourceSansLight;
    FontSize = Enum.FontSize.Size18;
    })

    wait(10)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "If you don't know how to play, read the description!";
    Color = Color3.new(100, 100, 0);
    Font = Enum.Font.SourceSansLight;
    FontSize = Enum.FontSize.Size18;
        })
wait(10)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Selecting random arena...";
    Color = Color3.new(100, 100, 0);
    Font = Enum.Font.SourceSansLight;
    FontSize = Enum.FontSize.Size18;
        })
wait(5)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = "Arena selected. Prepare to enter the game. May the odds be ever in your favor.";
    Color = Color3.new(100, 100, 0);
    Font = Enum.Font.SourceSansLight;
    FontSize = Enum.FontSize.Size18;
        })
wait(20)
local Pos = player.Character:GetPrimaryPartCFrame()
                    player:LoadCharacter()
                    player.Character:SetPrimaryPartCFrame(Pos)
                    if player.Character:FindFirstChild("ForceField") then
                        player.Character["ForceField"]:Destroy()
                        wait(1)
                        game.Workspace.CanCollide = false
                        game.ReplicatedStorage.Remotes.tp:FireServer()

                        end
end
end
end)


In that script, I think I corrected everything to a semicolon.

It's also really important to not put a print inside the table.

If this helped, please accept the answer. If you have any more questions, comment on this.

This discussion is preserved as it was. New answers, comments, and votes are closed.