So I am trying to make a staff lock system, and it does work. But the problem is that it doesn’t show on everyone’s screens and possibly only HR’s can see the UI and not everyone in the server.
What am I trying to achieve? I want to have everyone in the server see the GUI when someone that is an HR unlocks the server.
Have I tried anything to solve? I know how to script, but I don’t know why the UI is not showing for everyone.
Here is the whole script:
local MinimumRankToUseCommands = 190
local MinimumRankToJoinSlocked = 120
local ServerLockMessage = "Sorry! The server is currently locked for guests. If there is no one in the game, there is no show. If there is people in the game, staff may be setting up for the show or there is something private for certain people only. If you are here for the scueduled time of a show, please wait for the direct time when the server opens" --REPLACE THE TEXT INSIDE OF THE "" WITH YOUR SERVER LOCK MESSAGE
local ServerLocked = true
game.Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message)
if Player:GetRankInGroup(GroupId) >= MinimumRankToUseCommands then
if Message == "?slock" then
ServerLocked = true
local Players = game.Players:GetPlayers()
for i = 1, #Players do
local CurrentPlayer = Players[i]
local UI = Player.PlayerGui.SLock_System.Frame
local ServerLockMessage = Player.PlayerGui.SLock_System.Frame.Text1
local ServerLockMessage2 = Player.PlayerGui.SLock_System.Frame.Text2
local Image = Player.PlayerGui.SLock_System.Frame.Image
UI:TweenPosition(UDim2.new(0,0,0.688,0),"Out","Back", 1.5)
ServerLockMessage.Text = "The server is now locked"
ServerLockMessage2.Text = "Guests will not be able to join"
Image.Image = "rbxassetid://257119639"
wait(7)
UI:TweenPosition(UDim2.new(-0.3,0,0.688,0),"In","Back", 1.5)
end
elseif Message == "?unslock" then
ServerLocked = false
local Players = game.Players:GetPlayers()
for i = 1, #Players do
local CurrentPlayer = Players[i]
local UI = Player.PlayerGui.SLock_System.Frame
local ServerLockMessage = Player.PlayerGui.SLock_System.Frame.Text1
local ServerLockMessage2 = Player.PlayerGui.SLock_System.Frame.Text2
local Image = Player.PlayerGui.SLock_System.Frame.Image
UI:TweenPosition(UDim2.new(0,0,0.688,0),"Out","Back", 1.5)
ServerLockMessage.Text = "The server is now unlocked"
ServerLockMessage2.Text = "Guests are now able to join the server"
Image.Image = "rbxassetid://257126508"
wait(7)
UI:TweenPosition(UDim2.new(-0.3,0,0.688,0),"In","Back", 1.5)
end
end
end
end)
if ServerLocked == true then
if Player:GetRankInGroup(GroupId) < MinimumRankToJoinSlocked then
Player:Kick(ServerLockMessage)
end
end
end)```