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

How would i make a command that would make a gui fade in then fades out, but everyone would see it ?

Asked by 4 years ago

So the command i want to do is :slock, then it would make the whole gui fades in but for everyone to see it. But when i say :unslock, it would fades in again but as another text. Basically i want the server to be locked but also for the gui to show to everyone, it has to fade in though. This is at what i am right now.

----Script is in workspace------
local slock = false
local ServerlockGui = game.StarterGui.ServerLock.Frame --This would fades in along with the text and would fades ----
local LockOn = ServerlockGui.ServerlockOn ----it would fade in----
local LockOff = ServerlockGui.ServerlockOff

game:GetService("Players").PlayerAdded:Connect(function(plr)
if slock == true then
plr:Kick("The server is locked.")
elseif slock == false then
wait()
end
plr.Chatted:connect(function(msg)
if msg == ":slock" then
slock = true
for fadesin = 0,1, .0 do
LockOn.TextTransparency = fadesin
end
wait(2)

for fadesout = 1,0. .-.1 do
LockOn.TextTransparency = fadesout
end


---Now the unslock command---- 

plr.Chatted:connect(function(msg)
if msg == ":slock" then
slock = false
for fadesin = 0,1, .0 do
LockOff.TextTransparency = fadesin
end
wait(2)

for fadesout = 1,0. .-.1 do
LockOff.TextTransparency = fadesout
end

I am confused because i can't make it seen by everyone and i don't know how, can i get some help ?

0
You will need a remote event or you could go through every player in game.Players and change all of their guis kingblaze_1000 359 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

You can use a in pair loop or remote event.

In-pair loop

for i, v in pairs (game.Players:GetPlayers()) do
    -- Event for every player.
end

Remote Event (Put in ReplicatedStorage)

Script 1:

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

RemoteEvent:FireAllClients()

Script 2 (LocalScript):

local RemoteEvent = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

RemoteEvent.OnClientEvent:Connect(function()
    -- Your desired event.
end)
0
So what do i do about the command ? FireStorm67839 2 — 4y
0
Like, i don't know if i can do the plr.Chatted:Connect(function(msg) at the line 4 in the local script, can i get that confirmation ? FireStorm67839 2 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I wont give you the script but you need to know these basic functions. And a little bit knowledge about Remotes.

Use FireAllClients, which basically is a remote event for GUIs, this will make the gui visible.

'Also, when the game starts the gui's are not in the StarterGUI', they're in the PlayerGUI located in the player. I'm going to skip that and put a local script in the ScreenGUI so we do not need to reference it.

Then insert the gui variable as the parameter in fireallclients. Then handle the GUI, from the server script.

Answer this question