Tween GUI for Everyone

Hello,
I’m trying to make it so it tweens the GUI for everyone, But, it only shows for the player who fired the event. I already got the Highlight and sound to work, could anyone please help me?

This is the code.

local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.DirectionRE.RedGreen
local OnOff = true
local Sound = game.Workspace.DoorsDirection.Sound
--Info1 Pos = {0.5, 0},{0, 0}
--Info2 Pos = {0.5, 0},{0.039, 0}

Event.OnServerEvent:Connect(function(plr)
	local PlayerGUI = plr.PlayerGui
	local ModifyText = plr.PlayerGui.TextInfo
	if OnOff == true then
		game.Workspace.DoorsDirection.RedGreen.Highlight.Enabled = true
		Sound:Play()
		ModifyText.Info1.Text = "Head To Your Next Game,"
		ModifyText.Info2.Text = "Red Light, Green Light"
		PlayerGUI.TextInfo.Info1:TweenPosition(UDim2.new(0.5, 0,0, 0),
			"Out",
			"Quart",
			2,
			true)
		PlayerGUI.TextInfo.Info2:TweenPosition(UDim2.new(0.5, 0,0.039, 0),
			"Out",
			"Quart",
			2,
			true)
		wait(2)
		Sound:Play()
	OnOff = false
	else
		PlayerGUI.TextInfo.Info1:TweenPosition(UDim2.new(0.5, 0,-0.5, 0),
			"In",
			"Quart",
			1,
			true)
		PlayerGUI.TextInfo.Info2:TweenPosition(UDim2.new(0.5, 0,-1, 0),
			"In",
			"Quart",
			1,
			true)
		wait(1)
		game.Workspace.DoorsDirection.RedGreen.Highlight.Enabled = false
		OnOff = true
	end
end)

Sorry if the code is messy

4 Likes

Could you show me the server script?

1 Like

This is the server script (stuff to extend it so aaaaaaaeeee)

1 Like

Update: the other method I wrote previously doesn’t actually work, however you can still:
FireAllClients() on server event and let the local script handle the rest.

4 Likes

I’ll test this out first, I’ll tell you if I encounter any issues.

ServerScript
--ServerScriptService
local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.DirectionRE.RedGreen
local Sound = workspace.DoorsDirection.Sound
local Highlight = workspace.DoorsDirection.RedGreen.Highlight
local OnOff = true

Event.OnServerEvent:Connect(function()
	if OnOff then
		Highlight.Enabled = true
		Sound:Play()
		Event:FireAllClients(true, "Head To Your Next Game,", "Red Light, Green Light")
		task.wait(2)
		Sound:Play()
		OnOff = false
	else
		Event:FireAllClients(false)
		task.wait(1)
		Highlight.Enabled = false
		OnOff = true
	end
end)
LocalScript
--StarterPlayerScripts or StarterGui
local Rep = game:GetService("ReplicatedStorage")
local Event = Rep.DirectionRE.RedGreen
local UI = game.Players.LocalPlayer.PlayerGui:WaitForChild("TextInfo")

Event.OnClientEvent:Connect(function(state, txt1, txt2)
	if state then
		UI.Info1.Text = txt1
		UI.Info2.Text = txt2
		UI.Info1:TweenPosition(UDim2.new(0.5,0,0,0),"Out","Quart",2,true)
		UI.Info2:TweenPosition(UDim2.new(0.5,0,0.039,0),"Out","Quart",2,true)
	else
		UI.Info1:TweenPosition(UDim2.new(0.5,0,-0.5,0),"In","Quart",1,true)
		UI.Info2:TweenPosition(UDim2.new(0.5,0,-1,0),"In","Quart",1,true)
	end
end)

Was this the second thing he was talking about?

I not sure what you mean… this is how you fire all clients at the same time.

1 Like

Yes, I recommend using that method. Did the other one work though?

2 Likes

Well I did some testing, but it wasn’t able to retract (For some reason)… Thanks anyway!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.