my script:
001 | local figure = script.Parent |
002 | local Tool = script.Parent.PaintballGun |
003 | local reload = . 5 |
004 |
005 | function modechange() |
006 | local mode = figure.mode |
007 | if mode.Value = = 1 then reload = . 5 |
008 | elseif mode.Value = = 2 then reload = 5 |
009 | elseif mode.Value = = 3 then reload = 1.5 |
010 | elseif mode.Value = = 4 then reload = 10 end |
011 | end |
012 |
013 | function findNearestTorso() |
014 | local targetTorso = nil |
015 | local distance = 500 |
i want to make it so it shoots enemy team only not any player. so it does not shoot its own team mate it only shoots at enemy.
I believe I know how to fix this...
Basically, create teams and make a separate that randomly chooses teams or they can choose their team. You must also choose team colours as these are important to the script.
Then, use this script:
01 | local figure = script.Parent |
02 | local Tool = script.Parent.PaintballGun |
03 | local reload = . 5 |
04 |
05 | function modechange() |
06 | local mode = figure.mode |
07 | if mode.Value = = 1 then reload = . 5 |
08 | elseif mode.Value = = 2 then reload = 5 |
09 | elseif mode.Value = = 3 then reload = 1.5 |
10 | elseif mode.Value = = 4 then reload = 10 end |
11 | end |
12 | local player = game.Players.LocalPlayer |
13 | if player.TeamColor = = 'TeamColour' then |
14 | function findNearestTorso() |
15 | local targetTorso = nil |
16 | local distance = 500 |
17 | end |