can someone help me make this?
this is the only thing i can do by myself
01 | function onTouched(hit 1 ) |
02 | local torso 1 = hit 1. Parent:findFirstChild( "Torso" ) |
03 | if torso 1 ~ = nil then |
04 | Y = game.Players:playerFromCharacter(hit 1. Parent) |
05 | if Y.TeamColor = = BrickColor.new( "Deep blue" ) then |
06 | -- i dont know what to put here |
07 |
08 | end |
09 | end |
10 | end |
please help I am the worst scripter
QUICK TIP: A more efficient way of doing your script would be to check for the player straight away.
CODE:
01 | -- Script is inside the part that gets touched |
02 |
03 | local color = BrickColor.new( "Deep blue" ) |
04 |
05 | script.Parent.Touched:connect( function (hit) |
06 | local p = game.Players:GetPlayerFromCharacter(hit.Parent) |
07 | if p then |
08 | if p.TeamColor = = color then |
09 | local tool = hit.Parent:FindFirstChild( "ToolName" ) -- or, p.Backpack:FindFirstChild("ToolName"), so you can disable it even if it's unequipped |
10 | if tool then |
11 | tool.Enabled = false |
12 | end |
13 | end |
14 | end |
15 | end ) |