Take this as a question and not a request.
How would I detect when someone captures a flag on a team because I'm making a CTF gamemode. What events would I use to achieve this.
My leaderboard script
1 | local stats = { "value" , "Omegite" , "Captures" } |
2 |
3 | game.Players.PlayerAdded:connect( function (player) |
4 | local leaderstats = Instance.new( "Model" , player) |
5 | leaderstats.Name = "leaderstats" |
6 | for _, stat in pairs (stats) do |
7 | Instance.new( "IntValue" , leaderstats).Name = stat |
8 | end |
9 | end ) |
Try this script:
01 | function findAllFlagStands(root) |
02 | local c = root:children() |
03 | for i = 1 ,#c do |
04 | if (c [ i ] .className = = "Model" or c [ i ] .className = = "Part" ) then |
05 | findAllFlagStands(c [ i ] ) |
06 | end |
07 | if (c [ i ] .className = = "FlagStand" ) then |
08 | table.insert(stands, c [ i ] ) |
09 | end |
10 | end |
11 | end |
12 |
13 | function hookUpListeners() |
14 | for i = 1 ,#stands do |
15 | stands [ i ] .FlagCaptured:connect(onCaptureScored) |