i have 2 gates one goal (GoalA, GoalB) and a half (HalfA, HalfB) per set but when i put it in the next track only one of them works this is the code for it please can someone help me
A = script.Parent.GoalA
B = script.Parent.GoalB
A.CFrame = CFrame.new(A.Position,B.Position)
B.CFrame = CFrame.new(B.Position,A.Position)
C = A:Clone()
Dist = (A.Position-B.Position).magnitude
C.Size = C.Size + Vector3.new(-5,-1,Dist-2)
C.CFrame = A.CFrame + A.CFrame.lookVector*Dist/2
C.CFrame = CFrame.new(C.Position,A.Position)
C.Mesh:Remove()
C.Parent = A.Parent
C.Name = "Goal"
D = C:Clone()
D.Size = D.Size + Vector3.new(0,-100,0)
D.CFrame = C.CFrame + Vector3.new(0,C.Size.y/2+0.5,0)
D.Parent = A.Parent
D.Name = "GoalRib"
C.Transparency = 1
C.CanCollide = false
Goal = C
------
A = script.Parent.HalfA
B = script.Parent.HalfB
A.CFrame = CFrame.new(A.Position,B.Position)
B.CFrame = CFrame.new(B.Position,A.Position)
C = A:Clone()
Dist = (A.Position-B.Position).magnitude
C.Size = C.Size + Vector3.new(-5,-1,Dist-2)
C.CFrame = A.CFrame + A.CFrame.lookVector*Dist/2
C.CFrame = CFrame.new(C.Position,A.Position)
C.Mesh:Remove()
C.Parent = A.Parent
C.Name = "Half"
D = C:Clone()
D.Size = D.Size + Vector3.new(0,-100,0)
D.CFrame = C.CFrame + Vector3.new(0,C.Size.y/2+0.5,0)
D.Parent = A.Parent
D.Name = "HalfRib"
C.Transparency = 1
C.CanCollide = false
Half = C
game.Players.PlayerAdded:connect(function(Player)
local L = Instance.new("IntValue")
L.Name = "leaderstats"
local Lap = Instance.new("IntValue")
Lap.Name = "Lap"
Lap.Parent = L
L.Parent = Player
local LastCp = Goal
Half.Touched:connect(function(hit)
if game.Players:playerFromCharacter(hit.Parent) ~= Player then return end
if LastCp == Half then return end
if LastCp == Goal then LastCp = Half end
end)
Goal.Touched:connect(function(hit)
if game.Players:playerFromCharacter(hit.Parent) ~= Player then return end
if LastCp == Goal then return end
if LastCp == Half then LastCp = Goal Lap.Value = Lap.Value+1 end
end)
end)

2 comments
can u wrap the script using the code thingy so we can see the script properly
A = script.Parent.GoalC B = script.Parent.GoalD A.CFrame = CFrame.new(A.Position,B.Position) B.CFrame = CFrame.new(B.Position,A.Position) C = A:Clone() Dist = (A.Position-B.Position).magnitude C.Size = C.Size + Vector3.new(-5,-1,Dist-2) C.CFrame = A.CFrame + A.CFrame.lookVector*Dist/2 C.CFrame = CFrame.new(C.Position,A.Position) C.Mesh:Remove() C.Parent = A.Parent C.Name = "Goal" D = C:Clone() D.S