Made a Gate Remote (Why this dont work?)
Asked by
5 years ago Edited 5 years ago
I've made a gate remote (Tool) opens barriers.
However first two gates it works on but the latest one not.
01 | script.Parent.Activated:Connect( function () |
02 | local distance 1 = (script.Parent.Handle.Position - workspace.Fence_Gate 2. Model.Trigger.Position).magnitude |
03 | local distance 2 = (script.Parent.Handle.Position - workspace.Fence_Gate.Model.Trigger.Position).magnitude |
04 | local distance 3 = (script.Parent.Handle.Position - workspace.Fence_Gate 3. Model.Trigger.Position).magnitude |
05 | if distance 1 < distance 2 and distance 3 then |
06 | if distance 1 < = 50 then |
07 | game.Workspace.Fence_Gate 2. Model.RFID 1. LED.BrickColor = BrickColor.new( "Lime green" ) |
08 | game.Workspace.Fence_Gate 2. Model.allowed.Value = true |
10 | game.Workspace.Fence_Gate 2. Model.RFID 1. LED.BrickColor = BrickColor.new( "Bright orange" ) |
11 | game.Workspace.Fence_Gate 2. Model.allowed.Value = false |
13 | elseif distance 2 < distance 1 and distance 3 then |
14 | if distance 2 < = 50 then |
15 | game.Workspace.Fence_Gate.Model.RFID 1. LED.BrickColor = BrickColor.new( "Lime green" ) |
16 | game.Workspace.Fence_Gate.Model.allowed.Value = true |
18 | game.Workspace.Fence_Gate.Model.RFID 1. LED.BrickColor = BrickColor.new( "Bright orange" ) |
19 | game.Workspace.Fence_Gate.Model.allowed.Value = false |
21 | elseif distance 3 < distance 2 and distance 1 then |
23 | if distance 3 < = 50 then |
24 | game.Workspace.Fence_Gate 3. Model.RFID 1. LED.BrickColor = BrickColor.new( "Lime green" ) |
25 | game.Workspace.Fence_Gate 3. Model.allowed.Value = true |
27 | game.Workspace.Fence_Gate 3. Model.RFID 1. LED.BrickColor = BrickColor.new( "Bright orange" ) |
28 | game.Workspace.Fence_Gate 3. Model.allowed.Value = false |
He doesnt reach the latest code.