Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GUI Script For Team Selector GUI Cause i Can't coding to much :( how then? [closed]

Asked by
Flip265 -14
5 years ago

I want to make a Team selector GUI Like prison life,Jailbreak,Redwood prison but how?

1
Hold Alt+F4 Edbotikx 99 — 5y

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?

1 answer

Log in to vote
0
Answered by
Norbunny 555 Moderation Voter
5 years ago

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.

01-- Local script
02-- To be placed in your GUI
03 
04-- RemoteEvents shall be parented to ReplicatedStorage
05local replicatedStorage = game:GetService("ReplicatedStorage")
06local event = replicatedStorage:WaitForChild("YourEvent") -- The name of your remoteEvent
07 
08local gui = script.Parent
09 
10-- variables for your team's buttons
11local teamAButton = gui.Button
12local teamBButton = gui.Button2
13 
14-- Listening to the mouse's click
15teamAButton.MouseButton1Click:Connect(function()
View all 21 lines...

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!

01-- Script
02-- To be placed in the ServerScriptService
03 
04local replicatedStorage = game:GetService("ReplicatedStorage")
05local teams = game:GetService("Teams") -- The teams service
06 
07-- Creating the RemoteEvent
08local event = Instance.new("RemoteEvent")
09event.Name = "YourEvent" -- The RemoteEvent's name
10event.Parent = replicatedStorage
11 
12event.OnServerEvent:Connect(function(player, arg1)
13    -- The first argument is ALWAYS the player who fired the event
14 
15    -- A RemoteEvent can pass many arguments, however, we are only listening to 1, the team.
View all 22 lines...
0
Thx Norbunny Flip265 -14 — 5y
Ad