I keep getting an error "Unable to cast to Dictionary" even though there isn't a dictionary/table. My tween only contains 1 number that aren't in a dictionary.
local Number1 = 0 Number1 += 1 local Tween = game:GetService("TweenService") local Inf =TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,1,false,0.1) Tween:Create(Number1 , Inf, Number1 - 1):Play()
Why do I get this error?
It says it cannot cast to dictionary because the Create method expects a dictionary as the third parameter. You cannot tween number values, you must tween an instance. The third parameter would hold the new properties of the instance in a dictionary, even if it is one value. If you want to tween a number, use a floatValue and adjust the value
https://developer.roblox.com/en-us/api-reference/function/TweenService/Create
-- Script example for tweening a float value local Tween = game:GetService("Tween"); local num = Instance.new("FloatValue"); num.Value = 1; num.Parent = game.Workspace; local info =TweenInfo.new( 0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 1, false, 0.1 ); local goal = { Value=num.Value - 1; }; Tween:Create(num, info, goal):Play();