More UDIM2 problems, this time its real weird

So this is a script that should tween a textlabel to another textlabel named “Amount”.
Only problem is it tweens it to either the corner of the screen or to a far distance underneath the right position. So why is this happening? Cause its weird.

-- display money recieved
game:GetService('ReplicatedStorage'):FindFirstChild('ShowMoney').OnClientEvent:Connect(function(moneynum)
	local text = script:FindFirstChild('MoneyText'):Clone()
	text.Text = "$"..moneynum

	local MoneyText = money:FindFirstChild('Amount')

	local tweenService = game:GetService('TweenService')
	local info = TweenInfo.new(.7,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

	local Back = tweenService:Create(text,info,{Position = MoneyText.Position})

	text.Parent = gui

	text.Position = UDim2.new(math.random(5,86)/100,0,math.random(5,86)/100,0)
	wait(0.7)
	Back:Play()
	Back.Completed:Wait()
	text:Destroy()
end)
1 Like

You don’t show the layout of your UI items so something to make sure of is that the Parent of both MoneyText and text are the same. You are setting the Parent of text to “gui” so you need to make sure the Parent of MoneyText is also “gui” as the position of the label is relative to its Parent.

2 Likes

Ohhh that makes sense! Thank you!

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