TweenService animation not playing from ModuleScript

For some strange reason, the animation from the modular script is not displayed on the client, but in Players>Player>PlayerGui it is displayed that the frame has changed its position to the desired one, I don’t understand what’s going on.

local tween = {}

local frame=game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("Dialogs").Frame
local tweenService=game:GetService("TweenService")
local tweenInfoOut=TweenInfo.new(
	3,
	Enum.EasingStyle.Bounce,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local tweenInfoIn=TweenInfo.new(
	2,
	Enum.EasingStyle.Bounce,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

function tween.AnimationTweenOut()
	print("Initial Position:", frame.Position)
	local tweenPlay=tweenService:Create(frame,tweenInfoOut,{Position=UDim2.new(0.6, 0,1, 0)})
	tweenPlay:Play()
	tweenPlay.Completed:Connect(function()
		print("Final Position:", frame.Position)
	end)
end

return tween

P.S. I call the animation from LocalScript.

instead of defining the frame in the module, pass it onto the function from the local script as a parameter, see if that works

example

local module = path to tween module
local frame = script.parent
module.AnimationTweenOut(frame)

and in your module delete the frame and just add frame inbeween the paranthesis in the function

It turned out that I accidentally mixed up the coordinates and changed the wrong one.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.