So I was creating a mode which speeds you up for a certain amount of time, and while it is doing that I changed the player's color3 values and stored the previous color in a table, but whenever i try to call the table and set the color back to it's previous color I get this error saying ("Color3 expected got nil")
Here is the code if you happen to take a look at this:
`local normalColor = {}
player.Humanoid.WalkSpeed = lightningMode.Settings.speed
game.ReplicatedStorage.Skills.Effects.LightningMode:Clone().Parent = player.HumanoidRootPart
for i,bodyPart in pairs(player:GetChildren()) do
if bodyPart:IsA("BasePart") and bodyPart.Name ~= "HumanoidRootPart" then
table.insert(normalColor,bodyPart.Color)
bodyPart.Color = Color3.new(0,0,255)
bodyPart.Transparency = .7
end
end
for i,v in pairs(normalColor) do
print(v)
end
wait(lightningMode.Settings.duration)
player.Humanoid.WalkSpeed = 16
for bodyPartIndex,bodyPart in pairs(player:GetChildren()) do
if bodyPart:IsA("BasePart") and bodyPart.Name ~= "HumanoidRootPart" then
print(bodyPartIndex)
bodyPart.Color = normalColor[bodyPartIndex]
bodyPart.Transparency = 0
end
end
player.HumanoidRootPart:FindFirstChildOfClass("ParticleEmitter"):Destroy()
end`

2 comments
what line did you get the error in
I get the error in line 19