I’m trying to tween a ui but it’s not working. I’m pretty sure this code is similar to the one I always use and it always works. But in this situation, for some reason it’s not working.
Script
wait(7)
script.Parent.Enabled = true
local Gui = game.StarterGui.ActualUi
local Home = Gui.HomeScreen
local Store = Gui.Store
local Teams = Gui.Teams
-------------------------------------------------------------------
local btnHolder = Gui.Organizer
local homeBtn = btnHolder.Home
local storeBtn = btnHolder.Store
local teamsBtn = btnHolder.Teams
-------------------------------------------------------------------
--Home, Store, Teams OG position {0.5, 0},{0.562, 0}
storeBtn.MouseEnter:Connect(function()
Home:TweenPosition(UDim2.new(-2, 0, 0.562, 0), "Out", "Sine", 0.2)
end)
This but you don’t have to explicitly reference the PlayerGui instance, instead you could parent the script to the instance named “ActualUi” and reference it local Gui = script.Parent like this. That way when the Gui is cloned to the player’s PlayerGui folder the script correctly references the Gui inside of the PlayerGui of the player.
I don’t know what the hierarchy of the gui is and, what if the location of the script changes? Everything would break, also perhaps for something the author placed it like this.
My reply wasn’t a critique of yours (hence the “This” at the start of my reply), I was merely providing more information which the original poster could utilise (also giving a little bit more insight into what the “PlayerGui” is).
I know, I only say something obvious, if the author of the post had said the hierarchy, I would have written it as you say, it is only an approximation with the information he gave.