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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
appxritixn 2235 Moderation Voter Community Moderator
3 years ago

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.

Ad

Answer this question