So I'm trying to make it so that when PlaceVersion changes after I enforce an update, it will shutdown all the servers without me having to press shutdown and everyone wondering what just happened. But this script does not seem to work, Game.PlaceVersion.Changed:connect(update) does not work.
//SCRIPT
script.placeversion.Value = game.PlaceVersion print(script.placeversion.Value) function update() wait() print("The CURRENT Version is "..game.PlaceVersion) print("The OLD Version is "..script.placeversion.Value) if Game.PlaceVersion > script.placeversion.Value then print("Got past the if statement") Game.Workspace.Main.Disabled = true Game.Workspace.RecreateMain.Disabled = true Game.Lighting.Alert.Value = "Updates were found; the server will now shutdown to enforce them." wait(3) Game.Lighting.Alert.Value = "Check the description to see what's new!" wait(3) for i = 1,5 do wait(1) Game.Lighting.Alert.Value = "Shutting down in about "..5-i.." Seconds." end wait(0.8) for a,c in ipairs(Game.Players:GetChildren()) do wait() c:Kick() end end end Game.PlaceVersion.Changed:connect(update)
I even tried to do it like this but it still didn't work.
script.placeversion.Value = game.PlaceVersion print(script.placeversion.Value) repeat wait(1) until Game.PlaceVersion ~= script.placeversion.Value wait() print("The CURRENT Version is "..game.PlaceVersion) print("The OLD Version is "..script.placeversion.Value) if Game.PlaceVersion > script.placeversion.Value then print("Got past the if statement") Game.Workspace.Main.Disabled = true Game.Workspace.RecreateMain.Disabled = true Game.Lighting.Alert.Value = "Updates were found; the server will now shutdown to enforce them." wait(3) Game.Lighting.Alert.Value = "Check the description to see what's new!" wait(3) for i = 1,5 do wait(1) Game.Lighting.Alert.Value = "Shutting down in about "..5-i.." Seconds." end wait(0.8) for a,c in ipairs(Game.Players:GetChildren()) do wait() c:Kick() end end