I need help. Unable to cast to Dictionary

I know this is probably not a rare problem, but I encountered it and I need help.


I get unable to cast to Dictionary in output for line 20. What this part of the script has to do is to tween the surfacelight’s angle. I tried to fix it myself for 50 minutes but furthest point I could get to didn’t get me this fixed, so I am asking for help here now.

You have to actually specify which property your changing.

Example:

TweenService:Create(IntValue, TweenInfo.new(1), {Value = 100})

Send your script in text form so I can fix it.

I used to try to type local angletw = tw:Create(angle, twi, {angle = anglevalue}) and local angletw = tw:Create(angle, twi, {Angle = anglevalue}), but it gives me the same error which is Unable to cast value to Object.

It’s because Angle isn’t a property of whatever your changing. Could you tell me what the angle instance is?

I mean like angle is a local for surfacelight’s property, and surfacelight’s angle property is 0 and the numbervalue is 45

You have to reference the actual Instance and then it’s property after.

Try this:

local angletw = tw:Create(light, twi, {Angle = anglevalue})

You should read the documentation if you have problems with a specific function.

Oh, well, thank you a lot for this.

1 Like

No problem. If you have any more questions, feel free to ask.