You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
make Update GUI be worked -
What is the issue? Include screenshots / videos if possible!
If i shutdown the server, scripts don’t work. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I asked friend scripters, but they didn’t find scripter’s problem.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- SoftShutdownScript
local PlaceId = 11727022045
local player = game.Players
local Players = game:GetService("Players")
local teleport = game:GetService("TeleportService")
local TeleportScreenCreator = script:WaitForChild("TeleportScreenCreator")
local CreateTeleportScreen = require(TeleportScreenCreator)
local SoftShutdownLocalScript = script:WaitForChild("SoftShutdownLocalScript")
TeleportScreenCreator.Parent = SoftShutdownLocalScript
SoftShutdownLocalScript.Parent = game:GetService("ReplicatedFirst")
local StartShutdown = Instance.new("RemoteEvent")
StartShutdown.Name = "StartShutdown"
StartShutdown.Parent = game.ReplicatedStorage
if not (game.VIPServerId ~= "" and game.VIPServerOwnerId == 0) then
game:BindToClose(function()
if #game.Players:GetPlayers() == 0 then
return
end
if game.JobId == "" then
return
end
StartShutdown:FireAllClients(true)
wait(2)
local ScreenGui = CreateTeleportScreen()
local function TeleportPlayer(Player)
teleport:Teleport(PlaceId,player)
end
for _,Player in pairs(Players:GetPlayers()) do
TeleportPlayer(Player)
end
game.Players.PlayerAdded:connect(TeleportPlayer)
while #Players:GetPlayers() > 0 do wait() end
end)
end
--SoftShutdownLocalScript
--Runs the soft shutdown Gui to warn players.
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")
local TeleportService = game:GetService("TeleportService")
--Set up teleport arrival.
TeleportService.LocalPlayerArrivedFromTeleport:Connect(function(Gui,Data)
if Data and Data.IsTemporaryServer then
--If it is a temporary server, keep showing the Gui, wait, then teleport back.
Gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui",10^99)
StarterGui:SetCore("TopbarEnabled",false)
StarterGui:SetCoreGuiEnabled("All",false)
wait(5)
TeleportService:Teleport(Data.PlaceId,Players.LocalPlayer,nil,Gui)
else
--If the player is arriving back from a temporary server, remove the Gui.
if Gui and Gui.Name == "SoftShutdownGui" then Gui:Destroy() end
end
end)
--Anything that can cause this to yeild will prevent teleport data being recieved.
local RenderStepped = RunService.RenderStepped
local StartShutdown = game.ReplicatedStorage:WaitForChild("StartShutdown")
local CreateTeleportScreen = require(script:WaitForChild("TeleportScreenCreator"))
--Set up event for when the server is shutting down.
StartShutdown.OnClientEvent:Connect(function()
--Create the Gui and have it semi-transparent for 1 second.
local Gui,Background = CreateTeleportScreen()
Background.BackgroundTransparency = 0.5
Gui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
wait(1)
--Tween the transparency to 0.
local Start = tick()
local Time = 0.5
while tick() - Start < Time do
local Dif = tick() - Start
local Ratio = Dif/Time
Background.BackgroundTransparency = 0.5 * (1 - Ratio)
RenderStepped:Wait()
end
Background.BackgroundTransparency = 0
end)
--TeleortScreenCreator
local teleport = game:GetService("TeleportService")
return function()
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SoftShutdownGui"
ScreenGui.DisplayOrder = 100
local Frame = Instance.new("Frame")
Frame.BackgroundColor3 = Color3.new(0,0,0)
Frame.Position = UDim2.new(-0.5,0,-0.5,0)
Frame.Size = UDim2.new(2,0,2,0)
Frame.ZIndex = 10
Frame.Parent = ScreenGui
local function CreateTextLabel(Size,Position,Text)
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = Size
TextLabel.Position = Position
TextLabel.Text = Text
TextLabel.ZIndex = 10
TextLabel.Font = "SourceSansPro"
TextLabel.TextScaled = true
TextLabel.TextColor3 = Color3.new(1,1,1)
TextLabel.TextStrokeColor3 = Color3.new(1,1,1)
TextLabel.TextStrokeTransparency = 0
TextLabel.Parent = Frame
end
CreateTextLabel(UDim2.new(0.5,0,0.1,0),UDim2.new(0.25,0,0.4,0),"Game Update")
CreateTextLabel(UDim2.new(0.5,0,0.05,0),UDim2.new(0.25,0,0.475,0),"Closing server to refresh")
return ScreenGui,Frame
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.