Cloning a GUI and Tweening it

I am trying to make a script that has functions where a TextLabel clones and moves. It doesn’t work when its cloned but it works when it isn’t cloned, can someone help me?

local function aMove()
	local aClone = a:Clone()
	aClone.Parent = player.PlayerGui
	TweenService:Create(aClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function wMove()
	local wClone = w:Clone()
	wClone.Parent = player.PlayerGui
	TweenService:Create(wClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function sMove()
	local sClone = s:Clone()
	sClone.Parent = player.PlayerGui
	TweenService:Create(sClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function dMove()
	local dClone = d:Clone()
	dClone.Parent = player.PlayerGui
	TweenService:Create(dClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

You didn’t give ScreenGui to TextLabel.

local function aMove()
	local screen: ScreenGui = Instance.new("ScreenGui")
	
	local aClone = a:Clone()
	aClone.Parent = screen

	TweenService:Create(aClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end
1 Like

Thank you,

I have edited it like this

local function aMove()
	local screen = Instance.new("ScreenGui")
	screen.Parent = player.PlayerGui
	local aClone = a:Clone()
	aClone.Parent = player.PlayerGui.ScreenGui
	
	TweenService:Create(aClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

I advise you to display the screen behind the function to avoid performance problems.
I was just showing you an example, but if your screen later erases, then everything is fine.

local tempScreen = Instance.new("ScreenGui")
tempScreen.Name = "TempScreen"
tempScreen.Parent = PlayerGui

local function aMove()
	local aClone = a:Clone()
	aClone.Parent = tempScreen
	TweenService:Create(aClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function wMove()
	local wClone = w:Clone()
	wClone.Parent = tempScreen
	TweenService:Create(wClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function sMove()
	local sClone = s:Clone()
	sClone.Parent = tempScreen
	TweenService:Create(sClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end

local function dMove()
	local dClone = d:Clone()
	dClone.Parent = tempScreen
	TweenService:Create(dClone, tutorial, {Position = UDim2.new(0.007, 0,0.104, 0)}):Play()
end
1 Like

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