Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

i got error unable to cast to dictionary at line 10?

probably cuz of roblox dev tutorials not being good

they didn't tell me that much of what goes where

and yes it is a gui i am trying to tween

wait(1.2)

local TS = game:GetService("TweenService")

local loading_screen = script.Parent
local loading_type_selected = loading_screen.load_type_selected.Value
local loading_types = loading_screen.logo.loading_types

local brick1_tween_info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 1)
local brick1_tween = TS:Create(loading_types.bricks.brick_1, brick1_tween_info, Vector2.new(0.5, 0.95))

function game_loading()
	if loading_type_selected == "bricks" then
		brick1_tween:Play()
	end
end

function check_if_loaded()
	if not game:IsLoaded() then	
		game.Loaded:Wait()
		game_loading()
	end
	
	if game:IsLoaded() then
		
	end
end

1 answer

The reason you are getting the error is because the 3rd argument in TS:Create is a dictionary and you provided a Vector2 value.

Instead of this:

TS:Create(loading_types.bricks.brick_1, brick1_tween_info, Vector2.new(0.5, 0.95))

you should use this:

TS:Create(loading_types.bricks.brick_1, brick1_tween_info, {Position = Vector2.new(0.5, 0.95)})

I am assuming you are tweening a position here. If you aren't, change "Position" to the property you are tweening.

This discussion is preserved as it was. New answers, comments, and votes are closed.