Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Server shutdown not working?

Asked by
yoshiegg6 176
9 years ago

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

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

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.

0
Thanks. yoshiegg6 176 — 9y
0
Please upvote and accept. It helps me out. kthxbai yumtaste 476 — 9y
Ad

Answer this question