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

How would I turn this gui controlled by remote events into a local one?

Hi, I have this script located inside a textlabel, inside a gui.

Main = script.Parent
 
function FindContent(Directory,ContentName) -- helps wait for content
local Found = nil
repeat wait() Found = Directory:FindFirstChild(ContentName)
until Found
print("Found Content "..tostring(Directory))
return Found
end
 
local PrimaryFolder = workspace.Scripts:FindFirstChild("Secondary")
 
if PrimaryFolder then
local ServerMessage = FindContent(PrimaryFolder,"ClientMessage")
    if ServerMessage then
        ServerMessage.OnClientEvent:connect(function(TexttoDisplay)
            if TexttoDisplay then
                Main.Text = TexttoDisplay -- changes the text for the client.
            end
        end)
    end
end

And is called upon by other scripts by...

Main = script.Parent
math.randomseed(os.time())
ClientMessage = (Main:FindFirstChild("ClientMessage") or Instance.new("RemoteEvent",Main));ClientMessage.Name = "ClientMessage"
 
ClientMessage:FireAllClients("hi")

How would I go about in turning this into a local gui rather than one everyone can see?

1 answer

✓ Accepted answer

The easiest way to do this is to use

FireClient(game.Players.PlayerToShowTo, "Hi")

rather than

FireAllClients("Hi")

FireClient takes the specified user and fires the remote for them only, rather than doing it for everyone. If this is what you meant by making it local, then that should work for what you're trying to do.

If it helped, please accept this as the answer so people know you have been helped, and people having the same problem can find a solution. If you have any further questions feel free to ask.

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