Invalid Argument #3 (Color3 expected, got nil)? (SOLVED)
Asked by
4 years ago Edited 4 years ago
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:
01 | ` local normalColor = { } |
02 | player.Humanoid.WalkSpeed = lightningMode.Settings.speed |
03 | game.ReplicatedStorage.Skills.Effects.LightningMode:Clone().Parent = player.HumanoidRootPart |
04 | for i,bodyPart in pairs (player:GetChildren()) do |
05 | if bodyPart:IsA( "BasePart" ) and bodyPart.Name ~ = "HumanoidRootPart" then |
06 | table.insert(normalColor,bodyPart.Color) |
07 | bodyPart.Color = Color 3. new( 0 , 0 , 255 ) |
08 | bodyPart.Transparency = . 7 |
11 | for i,v in pairs (normalColor) do |
14 | wait(lightningMode.Settings.duration) |
15 | player.Humanoid.WalkSpeed = 16 |
16 | for bodyPartIndex,bodyPart in pairs (player:GetChildren()) do |
17 | if bodyPart:IsA( "BasePart" ) and bodyPart.Name ~ = "HumanoidRootPart" then |
19 | bodyPart.Color = normalColor [ bodyPartIndex ] |
20 | bodyPart.Transparency = 0 |
23 | player.HumanoidRootPart:FindFirstChildOfClass( "ParticleEmitter" ):Destroy() |