I'd recommend having a look at these, they will help you understand more about Roblox's API and coding on Roblox.
https://developer.roblox.com/en-us/api-reference/class/Teams
https://developer.roblox.com/en-us/api-reference/class/RemoteEvent
GUI's are client sided, so the LocalScript located in your GUI will handle client-sided input, the click, etc. You will need to fire a RemoteEvent to tell the server to change a user's team.
05 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
06 | local event = replicatedStorage:WaitForChild( "YourEvent" ) |
08 | local gui = script.Parent |
11 | local teamAButton = gui.Button |
12 | local teamBButton = gui.Button 2 |
15 | teamAButton.MouseButton 1 Click:Connect( function () |
16 | event:FireServer( "TeamA" ) |
19 | teamBButton.MouseButton 1 Click:Connect( function () |
20 | event:FireServer( "TeamB" ) |
And that's it for the client. Now we'll script the server's part. Once again, make sure to read the documentation on the topics you don't understand!
04 | local replicatedStorage = game:GetService( "ReplicatedStorage" ) |
05 | local teams = game:GetService( "Teams" ) |
08 | local event = Instance.new( "RemoteEvent" ) |
09 | event.Name = "YourEvent" |
10 | event.Parent = replicatedStorage |
12 | event.OnServerEvent:Connect( function (player, arg 1 ) |
17 | local team = teams [ arg 1 ] |
Closed as Not Constructive by Fifkee, GeneratedScript, and DeceptiveCaster
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?