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

Can only tween objects in the workspace? [SOLVED]

Asked by 5 years ago
Edited 5 years ago

Hey! Glad you can help me with this problem. ^^

Sooo, my problem is, I can't tween a TextLabel within a screen GUI. Thing is, this only happens in this specific game. I tried the exact same code in a testing place, and it worked just as I expected it to work.

Here is my localscript:

local NetworkFolder = game:GetService("ReplicatedStorage"):WaitForChild("NetworkFolder")
local player = game.Players.LocalPlayer
local playerGui = player.PlayerGui
local onCloseEvent = NetworkFolder:WaitForChild("onCloseEvent")
local onCloseGui = playerGui:WaitForChild("onCloseGui"):WaitForChild("TextLabel")

local function onCloseFunction()
    onCloseGui.Visible = true
     onCloseGui:TweenPosition(UDim2.new(0, 0, 0.1, 0), "Out", "Quad", 0.5)
end

onCloseEvent.OnClientEvent:Connect(onCloseFunction)

And this is where the PlayerGui is located:

https://gyazo.com/728f5bc3d879b1199fd8663b097869df

I've done buncha' research on the internet, devforum, wikis etc. but came back with no result. So now I'm leaning onto the community of scripting helpers to see if they know a fix. Anyone out there that have experienced this?

Oh yeah, by the way. Here is my testing in the game I am having the problem in:

https://gyazo.com/79f22fa03fe4f832518af2a580bfedf5

And here is a testing in a seperate game with the exact same coding:

https://gyazo.com/b0671da4f41aadb0288ac2f624cd52d3

Thank you for your support.

Waterfox

0
So what is most likely happening, you are destroying the gui when closing or re-parenting it. In that scenario, Your tween has no chance of playing, since gui is being destroyed. Add a wait(0.6) before you destroy the gui (slightly longer than the tween itself). Or even better, hook Destroy to TweenCompleted event. sleazel 1287 — 5y
0
I'm not destroying the gui. I am only tweening it. I just tested tweening it by firing a remote event. TheWaterFoox 255 — 5y
0
If object that was in playergui and now is not in the workspace, most likely it has been destroyed. Destroying sets the parent to nil. If you are not removing the object yourself, there is nothing else (that i know of) that will cause this error. Is reset on spawn checkbox unchecked by any chance? sleazel 1287 — 5y
0
Lul instead of hardocoding the wait, you should use Tween.Completed:Wait() (Or whatever the event is). Psudar 882 — 5y
View all comments (4 more)
0
Yall dumb... The reason is because you are trying to get stuff inside the playergui, all that is hidden, just do script.Parent.Parent...... To navigate to the desired label.. then tween... greatneil80 2647 — 5y
0
I put my localscript inside the textlabel that I am tweening and set the gui to tween to script.Parent. Still having the same issue. Only thing is that this is occuring only when I am in the spesific game. TheWaterFoox 255 — 5y
0
Found the issue. I was a little dumb, but yeah. Sleazel was right. The GUI was nil. That was because I defined the gui in the start of the script. When I defined the gui in the function, it worked just fine. TheWaterFoox 255 — 5y
0
I always end up finding a solution with random testing. lol TheWaterFoox 255 — 5y

Answer this question