"Unable to cast value to Object" error while tweening an object's color, what's wrong?
Here is my script, it's a server script.
01 | local PcOn = script.Parent |
03 | local rgb = PcOn.Parent.Parent.Case.rgbCables:GetChildren() |
05 | local colors = { BrickColor.new( "Steel blue" ).Color, |
06 | BrickColor.new( "Bright violet" ).Color, |
07 | BrickColor.new( "Magenta" ).Color, |
08 | BrickColor.new( "Neon orange" ).Color, |
09 | BrickColor.new( "Bright yellow" ).Color, |
10 | BrickColor.new( "Lime green" ).Color, |
11 | BrickColor.new( "Toothpaste" ).Color } |
13 | local tweenService = game:GetService( "TweenService" ) |
15 | rgb.Material = ( "Neon" ) |
17 | function ColorChange(colorToChangeTo) |
19 | local tweenInformation = TweenInfo.new( 1 ) |
20 | local ColorProperty = { } |
22 | ColorProperty.Color = colorToChangeTo |
24 | local tween = tweenService:Create(rgb,tweenInformation,ColorProperty) |
32 | if PcOn.Value = = true then |
33 | for i, v in ipairs (colors) do |
It used to work but when I added the "while" loop at the end, it suddenly stopped working, even though I need the while loop to check the value of the BoolValue instance.
I get this error when the script runs:
21:40:33.919 Unable to cast value to Object - Server - RgbOn:24
21:40:33.919 Stack Begin - Studio
21:40:33.919 Script 'Workspace.PC.Motherboard.IsPcOn.RgbOn', Line 24 - function ColorChange - Studio - RgbOn:35
21:40:33.920 Script 'Workspace.PC.Motherboard.IsPcOn.RgbOn', Line 34 - Studio RgbOn:45
21:40:33.920 Stack End
All help is appreciated.