GUI Cloning Position

Howdy, fellow developers!

I’m in need of help about this script…

I’m trying to move the position of the GUI’s clone, but it doesn’t work for some reason… If you know what’s the problem, please give feedback! Thank you.

------------------------------------------------------------------------------------------

local MsgTXT = script.Parent.Parent.Testing

local debounce = false

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)

local MsgOut = tweenService:Create(MsgTXT:Clone(), tweenInfo, {Position = UDim2.new(0.095, 0,0.429, 0), BackgroundTransparency = 0})

script.Parent.MouseButton1Click:Connect(function()
	if not debounce then
		debounce  = true
		
		
		MsgOut:Play()
		
		
		print("Cleared")
		
		
		wait(3)
		debounce = false
	end
end)

------------------------------------------------------------------------------------------

Use the :TweenPosition() function .Learn more here: GUI Animations

You didn’t set a Parent for you clone, try this script instead:

local MsgTXT = script.Parent.Parent.Testing

local debounce = false

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(0.3, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)

script.Parent.MouseButton1Click:Connect(function()
	if not debounce then
		debounce  = true

		local GuiClone = MsgTXT:Clone()
		GuiClone.Parent = MsgTXT.Parent

		local MsgOut = tweenService:Create(GuiClone, tweenInfo, {Position = UDim2.new(0.095, 0,0.429, 0), BackgroundTransparency = 0})


		MsgOut:Play()


		print("Cleared")


		wait(3)
		debounce = false
	end
end)
1 Like

Thank you so much for the feedback! It works perfectly.

Thank you for your help and time.

1 Like