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

I want to make a game with a team choice and class choice like blood and iron?

Asked by
AliTzuTzu -22
4 years ago

I want to make a game like blood and iron but based in another time period, the problem is I'm a a noob when it comes to team changing and class changing scripts, especially the blood and iron class change options which looks difficult and confusing to script so I'm here to ask if anyone could help me out?

1 answer

Log in to vote
2
Answered by 4 years ago

Some people haven't played that game, explaining more about it would be helpful.

GuiButton.MouseButton1Click

https://developer.roblox.com/api-reference/event/GuiButton/MouseButton1Click

Using the MouseButton1Click event, we can tell if a Player has clicked on a GuiButton. This will give us information on what team the player wants to join.

Player.Team

https://developer.roblox.com/api-reference/property/Player/Team

When a player is on a team, the PlayerObject has a property: Player.Team. We can use this to set or switch the player's team.

Team:GetPlayers()

https://developer.roblox.com/api-reference/function/Team/GetPlayers

To check the amount of players on a team, we can use Team:GetPlayers() to return a table containing all the players on that team. #Team:GetPlayers() will give us the number of players on that team and with some comparing, we can make sure the teams are balanced.

Remote Events

https://developer.roblox.com/articles/Remote-Functions-and-Events

Since your game should be Filtering Enabled, we must use RemoteEvents to communicate between the Client and the Server. We have to do this because MouseButton1Click is only used on the Client. Have the client RemoteEvent:FireServer() to send a signal on what team they want to join and have the server listen for the signal with RemoteEvent.OnServerEvent and set the player's Team accordingly.

0
Man really came through with the entire script logic. Crazy to see anyone actually filling requests for people, as this isn't exactly a request site. Good stuff. Hopefully the guy returns and accepts your answer, along with learning. Psudar 882 — 4y
Ad

Answer this question