Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Made a Gate Remote (Why this dont work?)

Asked by
dekkeda 30
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.

01script.Parent.Activated:Connect(function()
02    local distance1 = (script.Parent.Handle.Position - workspace.Fence_Gate2.Model.Trigger.Position).magnitude
03    local distance2 = (script.Parent.Handle.Position - workspace.Fence_Gate.Model.Trigger.Position).magnitude
04    local distance3 = (script.Parent.Handle.Position - workspace.Fence_Gate3.Model.Trigger.Position).magnitude
05    if distance1 < distance2 and distance3 then
06        if distance1 <= 50 then
07            game.Workspace.Fence_Gate2.Model.RFID1.LED.BrickColor = BrickColor.new("Lime green")
08            game.Workspace.Fence_Gate2.Model.allowed.Value = true
09            wait(5)
10            game.Workspace.Fence_Gate2.Model.RFID1.LED.BrickColor = BrickColor.new("Bright orange")
11            game.Workspace.Fence_Gate2.Model.allowed.Value = false
12        end
13        elseif distance2 < distance1 and distance3 then
14            if distance2 <= 50 then
15                game.Workspace.Fence_Gate.Model.RFID1.LED.BrickColor = BrickColor.new("Lime green")
View all 31 lines...

He doesnt reach the latest code.

Answer this question