Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tweening Error Cast Dictionary?

Asked by 5 years ago
Edited 5 years ago

I look at roblox wiki scripting website to look for a proper tweening set up, But i get an error from output at line 20 about... Unable to cast to Dictionary

May someone help me what may i have done wrong?

local TweenService = game:GetService("TweenService") local part = script.Parent local mode = part.ColorsMode

local tweenInfo = TweenInfo.new( 2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true, 0 )

local colorstable = { ['1'] = BrickColor.new('Really black'), ['2'] = BrickColor.new('Really red'), ['3'] = BrickColor.new('Really blue') }

local tween = TweenService:Create(part,tweenInfo,mode,colorstable)

mode:GetPropertyChangedSignal('Value'):Connect(function() part.BrickColor = colorstable[tostring(mode.Value)] tween:Play() end)

0
The dictionaries keys are expected to be the properties to tween. You may want to use separate tweens and separate tables to tween them a colour at the time. Since duplicate keys are not possible. User#24403 69 — 5y
0
What can i do beside singling it? Because that will not get me anywhere to the colors i want to change with the tween changing it. User#25662 0 — 5y

Answer this question