Hello, so pretty much there are a bunch of values in a folder, and those values have attributes in them. But for some reason, the code down below just doesn’t work. I don’t get any errors or anything, nothing is even being printed.
By the way, the script checking the attributes is a local script.
Any help would be appreciated
for i, v in pairs(Tracks:GetDescendants()) do
if v:FindFirstChild("Switch") then
if v:GetAttribute("Terminus") and v:GetAttribute("Route") then
print("finding")
print(terminus)
print(route)
print(v:GetAttribute("Terminus"))
print(v:GetAttribute("Route"))
if v:GetAttribute("Terminus") == terminus and v:GetAttribute("Route") == route then
print("getting")
unswitch_sequence(v.Parent)
switch_sequence(v.Value)
print("done")
end
end
end
end
for i, v in pairs(Tracks:GetDescendants()) do
if v:FindFirstChild("Switch") then
print("switch has been found")
if v:GetAttribute("Terminus") and v:GetAttribute("Route") then
print("finding")
print(terminus)
print(route)
print(v:GetAttribute("Terminus"))
print(v:GetAttribute("Route"))
if v:GetAttribute("Terminus") == terminus and v:GetAttribute("Route") == route then
print("getting")
unswitch_sequence(v.Parent)
switch_sequence(v.Value)
print("done")
end
end
end
end
The attribute is made in studio, and the attribute is set as soon as the model spawns. And the local script that checks the attribute only runs if the player sits in the seat.
So I don’t think this is a matter of the for loop checking before the attribute is being set.
The attributes aren’t set when the player sits in the seat, the attributes are already set in studio. The attributes are checked when the player sits in the seat.
I’ve removed the “if Get:Attribute” thing and when I print it, it doesn’t even say nil, it’s literally just an empty space. It really doesn’t make any sense for me.