Ui tweening to a position that I did not state

I am making a notification ui that tells players when an item spawns, but the frame keeps tweening to the wrong location

local plr = game.Players.LocalPlayer
local ts = game:GetService("TweenService")

game.ReplicatedStorage.ItemSpawnClientEvent.OnClientEvent:Connect(function(item)
	print("wuh")
	local ui = plr.PlayerGui.ItemSpawnGui:Clone()
	ui.Enabled = true
	ui.Parent = plr.PlayerGui
	local frame = ui.ItemSpawnFrame
	local clone1 = item.BgGradient:Clone()
	clone1.Parent = frame
	local label = frame.TextLabel
	local clone2 = item.TextGradient:Clone()
	clone2.Parent = label
	
	label.Text = ("The "..item.Name.." has spawned")
	
	ts:Create(frame, TweenInfo.new(2), {Position = UDim2.new({0.341, 0},{0.013, 0})}):Play()
	wait(3)
	ts:Create(frame, TweenInfo.new(3), {Transparency = 1})
	ts:Create(label, TweenInfo.new(3), {TextTransparency = 1})
	wait(3)
end)

It keeps tweening to {0.318, 0},{0.234, 0} even though it is supposed to tween to {0.341, 0},{0.013, 0}

this is going to be UDim2.new(0, 0, 0, 0) because the parameters of UDim2 take 4 numbers (xScale, xOffset, yScale, and yOffset)

you’re providing 2 tables, not numbers.

additionally, I don’t know if this is intentional but there’s no :Play() at the end of the 2 tweens you created at the bottom.

1 Like

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