I want to get this track to switch and I have tried multiple ways to get this to work but simply will not work. It’s been a head scratcher.
The track will switch one way but not other over and its only getting certain children for what ever reason.
I spent a good 3 hours trying to diagnose the problem every way I could but the only way I found was to list off one block at a time which is inefficient.
local triggered = false
local RightGroup = script.Parent.Right:GetChildren()
local LeftGroup = script.Parent.Straight:GetChildren()
function click()
triggered = false
for i, RightTracks in pairs(RightGroup,LeftGroup) do
if triggered == true then
triggered = false
RightTracks.Transparency = 1
RightTracks.CanCollide = false
LeftGroup.Transparency = 0 -- you set this to what you want
LeftGroup.CanCollide = true -- also set this to what you want
elseif triggered == false then
triggered = true
RightTracks.Transparency = 0
RightTracks.CanCollide = true
LeftGroup.Transparency = 1 -- you set this to what you want
LeftGroup.CanCollide = false -- also set this to what you want
end
end
end
script.Parent.Clicker.ClickDetector.MouseClick:Connect(click)