Script parented to the text that is suppose to change from Unclaimed to Claimed once the SurfaceGui button is clicked:
local Claimed = script.Parent; local Frame = Claimed.Parent; local ClaimRemote = Frame:WaitForChild("RemoteEvent"); ClaimRemote.OnServerEvent:Wait(); print("fired") Claimed.Text = "Status: Claimed";
Local Script that is parented to StarterPlayerScripts:
local ThingInWorkspace = game.Workspace.OrderBoard.Part.SurfaceGui local function ConnectEvent(Gui) local Claim = Gui:WaitForChild("TextButton") local Connection = nil; print("aldiemejoost;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;") Connection = Claim.Activated:Connect(function() print("clicked") Connection:Disconnect(); Gui.RemoteEvent:FireServer(); end); end for _, Gui in ipairs(ThingInWorkspace:GetChildren()) do ConnectEvent(Gui); end ThingInWorkspace.ChildAdded:Connect(function(Obj) if (Obj.Name == "_example") then ConnectEvent(Obj); end end);
(Don't mind some of the print statements we were just trying to test it lmao)
We also have the RemoteEvent parented in the order board.
local Claimed = script.Parent; local Frame = Claimed.Parent; local ClaimRemote = Frame:WaitForChild("RemoteEvent"); ClaimRemote.OnServerEvent:Wait(); print("fired") Claimed.Text = "Status: Claimed";
You don't need to fire to the server to change the client's guis. Just do it directly from the local script. If you want to change it for every client then try using :FireAllClients()