Not Moving The First GUI?

Salutations,

I am currently creating a notification system. But the first message in my GUI doesn’t move when the second one is created. Video below!

External Media

Screenshot_34

-- Variables
local TweenService = game:GetService("TweenService")
local OnScreenTime = 3
local MessageRemote = game.ReplicatedStorage.ModuleScript:FindFirstChild("RemoteEvent")
local GuiObject = script.Parent.Template
local TweenInfoIn = TweenInfo.new(.3, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local TweenInfoOut = TweenInfo.new(.8, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)


local function bringMessage (MessageString: string)
	if MessageString and type(MessageString) == "string" then
		local GuiFrameObject = GuiObject.MessageFrame:Clone()
		GuiFrameObject.Parent = script.Parent.Box
		
		if script.Parent.Box.Message1.Value == nil then
			local EndPointData = {Position = UDim2.new(GuiFrameObject.Position.X, 0, GuiFrameObject.Position.Y.Scale - 0.3, 0)}
			local TweenObjectIn = TweenService:Create(GuiFrameObject, TweenInfoIn, EndPointData)
			
			TweenObjectIn:Play()
			script.Parent.Box.Message1.Value = GuiFrameObject
		elseif script.Parent.Box.Message1.Value ~= nil then
			local GuiObject1 = script.Parent.Box.Message1.Value
			
			if GuiObject1 then
				print("object found")
				local EndPointDataMessage1 = {Position = UDim2.new(GuiObject1.Position.X, 0, GuiObject1.Position.Y.Scale - 0.3, 0)}
				local TweenObjectInMessage1 = TweenService:Create(GuiObject1, TweenInfoIn, EndPointDataMessage1)
				
				TweenObjectInMessage1:Play()
				
				
				local EndPointData = {Position = UDim2.new(GuiFrameObject.Position.X, 0, GuiFrameObject.Position.Y.Scale - 0.3, 0)}
				local TweenObjectIn = TweenService:Create(GuiFrameObject, TweenInfoIn, EndPointData)
				
				TweenObjectIn:Play()
				script.Parent.Box.Message2.Value = GuiFrameObject
			end
		end
	end
end



MessageRemote.OnClientEvent:Connect(function(Message: string)
	bringMessage(Message)
end)

wait(5)
bringMessage("YAYAYAYYAYYAYAYA")
wait(3)
bringMessage("I CANT LOL-")
2 Likes

What type of instances are Message1 and Message2? I think your problem is here:

You are trying to tween the actual value of Message1 and if it’s a string value that won’t work. You would need to use the string to find the frame inside the “box” frame where you store it. You could use Box:FindFirstChild(GuiObject1)

1 Like

its a objectvalue so it does store the object

1 Like