GUI Tween on everyones screen?

Is it possible to make a GUI Tween appear on everyones screen?

My scenario:
I have a button that just moves to the right on click, but I want it to appear on everyones screen when it’s clicked because it is a panel that controls certain things.

e.g. ServerLock, if someone clicks ServerLock it’ll be on but the button will be shown as off for everyone else except the person who clicked it.

1 Like

You will need to use a RemoteEvent. Make it FireServer when you click the serverlock button, and after the server verifies that you have permission to lock it, tell every client to change the gui by using FireAllClients. (You need to connect to OnClientEvent in the localscript).

Example:

--Server
local remote = game.ReplicatedStorage.RemoteEvent
remote.OnServerEvent:Connect(function(plr, action)
    if action == "ServerLock" and Admins[plr.UserId] then
        ServerLock = true
        remote:FireAllClients("UpdateServerLock", true)
    end
end)

--Client
local remote = game.ReplicatedStorage:WaitForChild("RemoteEvent")
remote.OnClientEvent:Connect(function(action, value)
    if action == "UpdateServerLock" then
        label.Text = "Server Locked: " .. tostring(value)
    end
end)

--Serverlock button
remote:FireServer("ServerLock")

(note it’s just an example so you get the idea)

4 Likes

Of course. You could do that very simple with Remote Events.

You could make a Function in the GUI you want to change like this:

function ChangeButtonPosition(position)
	local Success, Error = pcall(function()
		script.Parent.Position = UDim2.new(position)
	end)
	
	if Success then
		print("Success!")
		return true
	else
		warn("There was an error!")
		return false
	end
end

I made the pcall function just in case the position is not a position.
When you change the Position of the button, make the server to :FireAllClients(Button Position) and call the function ChangeButtonPosition on the event OnClientEvent like:

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(ChangeButtonPosition)
3 Likes

Your answer and Kiriots are both really helpful, thank you so much!

1 Like

Thank you for your answer, good explanation. Appreciate it!