Can only tween objects in workspace? Despite the gui being in playergui?

  1. What do you want to achieve? Just trying to tween a frame size to make it “invisible”

  2. What is the issue? Can’t seem to play it

  3. What solutions have you tried so far? Tried doing :Create() but that doesn’t work with sizes.

local Player = game.Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local __MAINUI = PlayerGui:WaitForChild("MainUI")
local __MAINFRAME = __MAINUI:WaitForChild("MFrame")
local __MAIN = __MAINUI:WaitForChild("Main")
__MAINFRAME:TweenSize(UDim2.new(-0.004, 0,0.28, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, 1):Play()

Script is localscript inside replicatedfirst.

I’d recommend moving to standard TweenService calls rather than the deprecated UI specific calls. Try this:
game:GetService("TweenService"):Create(__MAINFRAME, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Size = UDim2.new(-0.004, 0, 0.28, 0)}):Play()
You can expand it like this:

local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local size = UDim2.new(-0.004, 0, 0.28, 0)
local tween = TweenService:Create(__MAINFRAME, info, {Size = size})
tween:Play()

I tried that, but it still doesn’t play the tween. :frowning:

Is the thread stuck waiting for all those instances? Try adding a debug print statement before and after the call, like:

print("Before")
tween:Play()
print("After")

And see if the code reaches either of those prints.

The debugs do print but still it does not play.
image

local info = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local size = UDim2.new(-0.004, 0, 0.28, 0)
local tween = TweenService:Create(__MAINFRAME, info, {Size = size})
Humanoid.Died:Connect(function()
		print("Before Died")
		tween:Play()
		print("After Died")
end)

I’m gonna try setting the frame to be invisible as an optional debug.
Tried printing the name too
image
gonna have to resort to a different localscript then.

Had to make a different script, this time INSIDE the frame since apparently replicatedfirst cant edit frames for whatever reason.

1 Like