GUI Server side Manipulation

I am having some troubles when it comes to manipulating Player GUIs when it comes to effecting all players. The main is function is after pressing the begin button it will say to all players that a raid is commencing. It will then fade to dark, which I only have working so far.
https://gyazo.com/d4c907909ec866c5212a909b66975e1d

This is what should display.
image

This is the code for the ServerScriptService without the GUI stuff as it does not work for me there.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RaidBegin = ReplicatedStorage:WaitForChild("Test")
local plr = game.Players.LocalPlayer



--local Announcement = game:GetService("Lighting").InvasionNotification:clone().Parent == plr.PlayerGui
--Announcement.Parent = plr.PlayerGUI

--Process
-- 1) Screen Fates to Black
-- 2) Screen Unfates to see view from different Camera
-- 3) Sees GUI Instruction
-- 4) 5 Second Beeping
-- 5) Can begin playing
RaidBegin.OnServerEvent:connect(function()

--Announcement.Announcement.Visible = true
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.1
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.2
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.3
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.4
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.5
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.6
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.7
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.8
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.9
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -1
--Announcement.Announcement.Visible = false
wait(5)


wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.9
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.8
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.7
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.6
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.5
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.4
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.3
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.2
wait (0.1)
game.Lighting.ColorCorrection.Brightness = -0.1
wait(0.1)
game.Lighting.ColorCorrection.Brightness = 0



game.workspace.Beep:Play()
wait(5)
print("End Of Script")
end)    
    
    script.Parent.MouseButton1Down:connect(function()
	
	if RaidSystem.RaidStatusChosen.Value == false then
		
		gui.Begin.Text = "A Raid Status has not been chosen, please select one"
		wait(2)
		
		gui.Begin.Text = "Begin"
	else
		RaidMenu:TweenPosition(UDim2.new(0.385, 0, 1.3, 0), "Out", "Quad", 0.5, true)
--		Countdown()
		game.ReplicatedStorage.Test:FireServer()
		
				if RaidSystem.PR.Value == true then
			print("Begin PR")
			
		else
			print("Begin Official Raid")
	
		end
		end
end)

It would be nice if you wrapped all of your code in codeblocks, rather than a portion of it, also, i would advise using a for loop when modifying the Color correction’s brightness to avoid unnecessary repetition

2 Likes

Highlight all your code (select it), then press the Preformatted Text button, it will make it easier to read.

1 Like

It must be OnClientEvent if it is a localscript

1 Like

Have you considered using Remotes to do this instead of the infamous hacky method of serverside GUI manipulation?

I am not really sure how Remotes work.

Okay so I can link you to some articles to how they work but the gist of it is that you can communicate from client to server or vice versa so that replication can be controlled. Roblox Description and Tutorial On Them. , FE Dev Forum Post

Essentially what you will want to do is have all the fancy GUI transitions on the client in the LocalScript.

So what you’re wanting here is someone what we’re referring to as the ‘controller’ that will be able to commence a raid, and they’ll have their own interface to do this. When the controller confirms the raid, they’ll likely press a button and what this button should do is fire a RemoteEvent using the :FireServer() function.This will be in a localscript.

You’ll then need a server script so that the server is able to detect this utilizing OnServerEvent, and when the server detects the remote being fired, you will then need to use the server to fire back to all clients to tell the clients to execute the fading GUI transition. You can do this using :FireAllClients().

Then back on the client again, you’ll need another listener to detect when FireAllClients is called, so you’ll be using OnClientEvent to do this, and this will contain the code that handles the fading animation.