Tween not playing

When the Frame is visible it will play the tween, but doesn’t seem to work. No errors.

Local Script:

local TweenService = game:GetService("TweenService")
local LoadingRing = script.Parent.LoadingRing
local LoadingText = script.Parent.LoadingText
local LoadingScreen = script.Parent
local Client = game:GetService("Players").LocalPlayer
local PlayerGui = Client.PlayerGui

local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local tween = TweenService:Create(LoadingRing, tweenInfo, {Rotation=360})
if PlayerGui:WaitForChild("LoadingScreen").Visible == true then
	tween:Play()
end

LoadingText.Text = "Loading."
wait(1)
LoadingText.Text = "Loading.."
wait(1)
LoadingText.Text = "Loading..."
script.Parent:Destroy()
1 Like

Are you sure you’ve indexed the right thing? ScreenGuis (which should be the direct child of the PlayerGui, or a child of another LayerCollector) don’t have a Visible property.

1 Like

Sorry, I meant a Frame, I have edited the post.

Is your frame a child of the PlayerGui?

By this line, it seems you’re looking for a GuiObject as a child of the player’s PlayerGui, a ScreenGui only has an Enabled property:

if PlayerGui:WaitForChild("LoadingScreen").Visible == true then
1 Like

This is the explorer.
image

I changed it to this,

if PlayerGui:WaitForChild("e"):WaitForChild("LoadingScreen").Visible == true then

And, it still doesn’t work. needed more words

@7z99 Hello??? needed more words

Oh sorry, you should press the reply button on the bottom-right of my reply to notify me.

If it isn’t playing, your object probably isn’t visible.

Would you like to test it out? @7z99

That’s alright, you should probably do some debugging though. Try adding a print statement, print(PlayerGui:WaitForChild("e"):WaitForChild("LoadingScreen").Visible)

It didn’t print the statement, and there is this.

Okay, it might be referencing an old instance. Make sure the ScreenGui’s ResetOnSpawn property is false, and make sure there is no space or anything in the name.

1 Like

Done, but still the same. needed more words @7z99

local TweenService = game:GetService("TweenService")
local LoadingRing = script.Parent.LoadingRing
local LoadingText = script.Parent.LoadingText
local LoadingScreen = script.Parent
local Client = game:GetService("Players").LocalPlayer
local PlayerGui = Client.PlayerGui

local tweenInfo = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local tween = TweenService:Create(LoadingRing, tweenInfo, {Rotation=360})

local tweenUi = function()
	if PlayerGui:WaitForChild('LoadingScreen').Visible then
		tween:Play()
	end
end

PlayerGui:WaitForChild('LoadingScreen'):GetPropertyChangedSignal('Visible'):Connect(tweenUi)
tweenUi()

LoadingText.Text = "Loading."
wait(1)
LoadingText.Text = "Loading.."
wait(1)
LoadingText.Text = "Loading..."
script.Parent:Destroy()

There is no function being fired if the visibility changes, here I have fixed that error.

Tween still doesn’t work, no errors. @Hxndaaa

Still have this warning,

This means that the script will yield forever until the instance gets added, are you sure that it is referenced properly?

Not sure. needed more words

I changed the script a bit. And, now the gui won’t even become visible when I do it through another gui with a button.