I want the loading screen to tween out of the screen after the game is loaded.
I keep getting an error saying “Unable to cast to Dictionary” which I don’t know what means lol.
Code
if game:IsLoaded() then
textLabel.Text = "Loaded!"
wait(2)
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween1 = TweenService:Create(textLabel, tweenInfo, {Vector3.new(-0.004, 0,-0.982, 0)})
tween1:Play()
end
Thats where the error is coming from
The code is a local script inside ReplicatedFirst.
The 3rd argument of TweenService:Create() should be a dictionary of properties. Also pretty sure textlabels don’t have any property that accept a Vector3, you probably meant to use a UDim2
Now it doesn’t give me the error so you fixed the error, but it still isn’t playing my tween. It just vanishes. I think it’s the tween itself but I don’t know what could be wrong.
The tween is probably just playing way too fast, you could just implement something like another yielding function so that it waits until that specific Instance is found
Try tweening it to 0, 0, 0, 0 maybe. -0.982 is almost 1 whole screen height upwards and the tween time is only 1 second so it probably tweens so fast you can’t really see it… Or maybe you’re not yielding until the tween is completed and destroying the label instantly?
It is still being destroyed instantly even though I added a wait before it is destroyed.
if game:IsLoaded() then
textLabel.Text = "Loaded!"
wait(2)
local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local tween1 = TweenService:Create(textLabel, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
tween1:Play()
end
if not game:IsLoaded() then
game.Loaded:Wait()
end
wait(5)
screenGui:Destroy()
local function Loaded()
textLabel.Text = "Loaded!"
wait(2)
local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out)
local tween1 = TweenService:Create(textLabel, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
tween1:Play()
end
if game:IsLoaded() then
Loaded()
else
game.Loaded:Wait()
Loaded()
end
wait(5)
screenGui:Destroy()
Well, it’s kinda hard to debug stuff like this without knowing your whole setup. Maybe it’s some other code causing this or maybe the anchor point of the textlabel is weird? It could be anything, I don’t really know… Any chance you could send the place file with just the gui code?
Okay just change the tween Position to UDim2.new(0, 0, -1, 0) Lol. You should also probably parent the loading ring to the text label so they move together