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

Server shutdown not working?

I made this server script shut down the server when I say "shut it down". It doesn't work. Please help.

players = game.Players
Sound1 = game.Workspace.ShutdownSound
Sound2 = game.Workspace.BSound
GUI = game.ServerStorage.GUI

game.Player.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if player.name = "yoshiegg6" and msg = "Shut it down" then
Sound1:Play()
Sound1.Looped = true
H = Instance.new("Hint", game.Workspace)
for i = 10,1,-1 do
H.Text = "Server shutting down in"..i.."seconds"
if i = 1 then
Sound2:Play()
for q,e in pairs (players:GetChildren()) do
GUI:Clone().Parent = e.PlayerGUI
end
for j,k in pairs (players:GetChildren()) do
k:Kick()
end

1 answer

Not sure about the rest of the code yet, but it looks good. You made one error over and over again.

When comparing variables, you use two equal signs (==), example:

if msg == "Shut dis shizzle down yall" then

If the variable "msg" is the string "Shut dis shizzle down yall," then the statement will keep running. Just search through your script, and any time you're comparing variables (line 8, line 14, etc.), make sure you have two =='s.

EDIT: Upon further examination, I noticed you have some ends missing. Just make sure you have 7 ends in total, two of which are end). Studio automatically adds them for you.

2 comments

0

Thanks.

0

Please upvote and accept. It helps me out. kthxbai

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