Error cloning guis

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I am making a notification system that creates a notification, tweens it, and hides it after.

  2. What is the issue? Include screenshots / videos if possible!
    The printed messages print, but nothing is cloned
    Explorer:
    image

Script:

-- Define default values
local DefaultInterval = 3
local DefaultDelay = 0

-- Define services
local TweenService = game:GetService("TweenService")

-- Define tween variables
local Notification = script.Parent.Notification

local ShowPosition = UDim2.new(0.113, 0, 0.048, 0)
local HidePosition = UDim2.new(0.113, 0, -0.13, 0)

local ShowTweenInformation = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, false, 0)
local HideTweenInformation = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, false, 0)

local ShowProperties = {["Position"] = ShowPosition}
local HideProperties = {["Position"] = HidePosition}

-- Runs when remote event is fired
game.ReplicatedStorage.Notify.OnClientEvent:Connect(function(TitleText, DescriptionText, interval, delaytime)
	-- Clone notification and set text
	local NewNotification = Notification:Clone()
	NewNotification.Title.Text = TitleText
	NewNotification.Description.Text = DescriptionText
	print("CLONED")
	
	-- Define tweens
	local ShowTween = TweenService:Create(NewNotification, ShowTweenInformation, ShowProperties)
	local HideTween = TweenService:Create(NewNotification, HideTweenInformation, HideProperties)
	
	-- Play tweens
	if interval ~= nil and delaytime ~= nil then
		wait(delaytime)
		ShowTween:Play()
		wait(interval)
		HideTween:Play()
		NewNotification:Destroy()
	elseif interval ~= nil then
		wait(DefaultDelay)
		ShowTween:Play()
		wait(interval)
		HideTween:Play()
		NewNotification:Destroy()
	elseif delaytime ~= nil then
		wait(delaytime)
		ShowTween:Play()
		wait(DefaultInterval)
		HideTween:Play()
		NewNotification:Destroy()
	else
		wait(DefaultDelay)
		ShowTween:Play()
		wait(DefaultInterval)
		HideTween:Play()
		NewNotification:Destroy()
	end
end)

You need to set the Parent of NewNotification after cloning it.

1 Like

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