Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I dont know how to make this from a local surfacegui to a global surfacegui?

So I got a problem here. I am making an admin panel and I made it password protected. My idea is when I press a button in the admin panel, everyone sees a certain gui on a certain model. My problem is I don't know how to make it a global image instead of local image on the Surface GUI. I need everyone to see it when I click it instead of just me seeing it. Here is the script.

local button = script.Parent
local pic = game.Workspace.DraftDetails.SurfaceGui.Frame.Welcome
local board = game.Workspace.DraftDetails.SurfaceGui.Frame

------------------------------------------------------------------------------------------


button.MouseButton1Click:Connect(function()
	if pic.Visible == false then			
		pic.Visible = true
		board.PickIsIn.Visible = false
	elseif pic.Visible == true then
		pic.Visible = false
			
	end
end)

I need to know how to make it Global. If anyone can help me, that would be great!

UPDATE: I am reading the RemoteEvents on wiki and its kind of helping me. So far i got this

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local button = script.Parent

local function ButtonClicked()
	
end

is that good so far?

8 comments

0

By the way, the certain gui is an ImageLabel, but its local which i dont want.

0

You will need to create the surface GUI on the server and use a RemoteEvent

0

Do you know a script that would work for this on a RemoteEvent?

0

Click here to learn how to use remote events: http://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events

0

Ok thanks i will read that.

0

Is all this on a local script? If it is, you need to make a global script to do this instead, aka a local script that references a remote event, or a module script with the function to show the surface gui.

0

Wait so where do i put the normal script in?

0

im completley lost.. i dont know what to do. i dont even know if what i have so far is right tbh.

1 answer

For first, you script of LocalScript its perfect, but you need to use RemoteEvent. The RemoteEvent send all for server, can only fired on Local Script

You can see more here: Roblox Wiki - RemoteEvent/Function

For use RemoteEvent, Create a RemoteEvent and put in ReplicatedStrorage!

Now create a Server Script and put on ServerScriptService

For use RemoteEvent you need to use EVENT.OnServerEvent:Connect(function(player) -- You need to get Player on RemoteEvent.

Here is a example:

local event = game.ReplicatedStorage.RemoteEvent

event.OnServerEvent:Connect(function(player)
	workspace.Part.Name = "Fired with RemoteEvent!"
end)

And in the client you need to use this:

local event = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1Click:Connect(function()
    event:FireServer()  -- Will fire the server, and start that function!
end)

And in button you need to fire the server! (Need a LocalScript.)

You can use this:

SERVER

local event = game.ReplicatedStorage.RemoteEvent
local pic = game.Workspace.DraftDetails.SurfaceGui.Frame.Welcome
local board = game.Workspace.DraftDetails.SurfaceGui.Frame

event.OnServerEvent:Connect(function(player)
	if pic.Visible == false then            
        pic.Visible = true
        board.PickIsIn.Visible = false
    elseif pic.Visible == true then
        pic.Visible = false
    end
end)

CLIENT

local button = script.Parent
local event = game.ReplicatedStorage.RemoteEvent

button.MouseButton1Click:Connect(function()
    event:FireServer() -- You don't need to send the player with FireServer.
end)

Hope it helped!

This discussion is preserved as it was. New answers, comments, and votes are closed.