So, I am trying to make a button that changes a team and also changes a Value, which is in PlayerGui. Using remoteevetns, I am trying to figure out how to change something in the PlayerGui from the script in ServerScriptService. Is there anybody who could tell me how to do this?
Here's something I wrote up similar to what I am trying to do:
Script in ServerScriptService (Script):
local ReplicatedStorage = game:GetService("ReplicatedStorage") local TestEvent = Instance.new("RemoteEvent") TestEvent.Parent = ReplicatedStorage TestEvent.Name = "TestEvent" local function TestEventRequest(player,TestValue) player.TeamColor = BrickColor.new("Bright red") TestValue = "Red" end TestEvent.OnServerEvent:Connect(TestEventRequest)
Script in TextButton (LocalScript):
function click() local TestValue = script.Parent.Parent.Parent.TestValue.Value local ReplicatedStorage = game:GetService("ReplicatedStorage") local Test = ReplicatedStorage:WaitForChild("TestEvent") wait (0.02) Test:FireServer(TestValue) end script.Parent.MouseButton1Down:connect(click)