I'm just really struggling with something right now
Basically, when a player in an FE game clicks a button on a ScreenGui, I need a SurfaceGui in Workspace to update its TextLabel.Text I don't know how to do this and its really fraustrating!! I've been trying to use RemoteEvents, but how do I make the change on the SurfaceGui replicate to everyone in the server?
Any help would be appriciated, thanks in advance.
Okay, so you need to put a LocalScript in StarterGui and a Script in ServerScriptStorage. You will also need to put the ScreenGui in StarterGui.
Yes, you will need RemoteEvents, so put one in ReplicatedStorage and name it what you want.
Now, in the LocalScript you will need it to fire the RemoteEvent when the player clicks on the ScreenGui element. It should look like this:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage.RemoteEvent local TextButton = script.Parent.ScreenGui.TextButton TextButton.MouseButton1Down:connect(function() RemoteEvent:FireServer("VIP") -- The text you want to appear in the TextLabel end
Now in the Script you will need to define what happens when the button is pressed.
local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage.RemoteEvent local TextLabel = game.Workspace.SurfaceGui.TextLabel RemoteEvent.OnServerEvent:connect(function(plr, text) TextLabel.Text = text end
That answer took me long to make so I'd appreciate if you marked this as the answer and gave it an upvote. Hope I helped you!