Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
290 views
in Technique[技术] by (71.8m points)

lua - How to rank captain to the first player to join a team roblox studio

I would like to know how I can do in roblox studio so that the first member that joins the blue team (it is not self-assignable) has the rank of captain.

and how i do when the captain presses that 'C' next to his teammate, that means that he will give that player the captain rank.

any idea how to do this? please


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

google "roblox player joins"

https://developer.roblox.com/en-us/api-reference/event/Players/PlayerAdded

The PlayerAdded event fires when a player enters the game. This is used to fire an event when a player joins a game, ...

Ok so now we know how to do something (execute code) when a player joins.

Captain

There is no such thing as a Captain in Roblox. If that is part of your game you'll have to give your player some rank attribute.

google Roblox player attribute hoping to find some help

https://developer.roblox.com/en-us/api-reference/function/Instance/SetAttribute

Looks like we do not even have to implement this ourselves!

So something like

playerInstance:SetAttribute("rank", "Captain")

should do the trick.

I have never worked with Roblox. But I know how to search the web and how to read documentations. This is what I found with 2 minutes of effort.

Break your problems down. You'll rarely find help on complex problems you came up with. But the internet is full of little bricks for pretty much anything in life.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...