Unable To Cast Dictionary

For my Roblox game I am creating a character selection GUI that allows the player to switch between multiple skillsets.
When attempting to tween the GUI to it’s given location I receive the error : Unable to cast to Dictionary - Client - LocalScript:12.
I have looked at multiple posts from other developers but overall have found no common error with any post.

Code - Located In StarterGUI

local CharacterSelectorEvent = game.ReplicatedStorage.CharacterSwitch:WaitForChild("CharacterSelect")
local CurrentClass = ""

script.Parent.Parent.MouseButton1Click:Connect(function()
	if script.Parent.UIEnabled == false then
		script.Parent.UIEnabled.Value = true
		local TS = game:GetService("TweenService"):Create(script.Parent, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = 0, 149,0, 135})
		local TS2 = game:GetService("TweenService"):Create(script.Parent.UIGridLayout, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CellSize = 0,150,0,40})
		TS:Play()
		TS2:Play()
	elseif script.Parent.UIEnabled.Value == true then
		local TS3 = game:GetService("TweenService"):Create(script.Parent, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = 0, 149,0, 0})
		local TS4 = game:GetService("TweenService"):Create(script.Parent.UIGridLayout, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CellSize = 0,150,0,0})
		script.Parent.UIEnabled.Value = false
		TS3:Play()
		TS4:Play()
	end
end) 
for i,v in pairs(script.Parent:GetChildren()) do
	if v:IsA("TextButton") then
		v.MouseButton1Click:Connect(function()
			for i2,v2 in pairs(game.ReplicatedStorage.Accessories:GetChildren()) do
				if v2.Name.."Button" == v.Name then
					local Player = script.Parent.Parent.Parent
					local Character = Player.Character
					if Character.Humanoid.Health == Character.Humanoid.MaxHealth then
						Player:LoadCharacter()
						CurrentClass = v2.Name
						wait(1)
						for i3, v3 in pairs(v2:GetChildren()) do
							v3.Tools:Clone().Parent = Player.Backpack
							local TS5 = game:GetService("TweenService"):Create(script.Parent.KojiroButton, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = 0, 149,0, 0})
							local TS6 = game:GetService("TweenService"):Create(script.Parent.BuddahButton, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CellSize = 0,150,0,0})
							script.Parent.UIEnabled.Value = false
							wait(1)
							TS5:Play()
							TS6:Play()

						end
					end
				end
			end
		end)
	end
end

1 Like

You need to wrap the property values with their respected datatypes, e.g for size, use UDim2.new()

You don’t have to use tweenservice to tween any type of gUI, this this case you can just tween the frame like this:

local frame = script.Parent

frame:TweenPosition(
     Udim2.new(0,0,0), -- Set this to the desired position
     Enum.EasingDirection.Out, -- Direction
     Enum.EasingStyle.Linear, -- Style
     1, -- Time
     false -- Overides a tween that is already playing?
) 

Thank You! I Can’t Believe I Didn’t Notice That :sob::sob:

I don’t recommend this from my experience. When I used this the frame didn’t tween as expected, while using TweenService tweened as expected

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.