Udim2 Help, Values comes up as 0?

Hello all! I am having a bit of trouble with my ModelPosition to UI position script. The script below does the following; 1. Take position of Monster Primary Part, 2. Get a Normalized X and Z coordinate, 3. Attempt to change Frame position to teh new X and Z… The problem is that the Udim2.new comes up empty! I ran some print functions and everything comes up fine before I change the Position, it is when i put these values into the Udim2.new that it comes up as 0… Please Help!

local RunService = game:GetService("RunService")
local MarkTable = {}
RunService.Heartbeat:Connect(function()
	local Map = workspace["Map Data"]:FindFirstChildOfClass("Folder")
	if Map then
		local voidpos= workspace["Map Data"]:FindFirstChildOfClass("Folder").Entities.Void.PrimaryPart.Position
		local Xratio = voidpos.X * (1/(620.002-14.121))
		local Zratio = voidpos.Z * (1/(757.146-76.463))
		print("VOIDXPOS: "..Xratio..", VOIDZPOS: "..Zratio)
		print(UDim2.new({Xratio,0},{Zratio,0}))
		script.Parent.MainFrame["Void Mark"].Position = UDim2.new({Xratio,0},{Zratio,0})
	end
end)

OUTPUT:
Screenshot 2024-01-20 185148

You are creating an UDim2 in the wrong format. It should be 4 numbers, not wrapped in tables:

UDim2.new(Xratio, 0, Zratio, 0)
1 Like

Oh my gosh, Thank you so much. I cannot believe i made such a simple mistake aha.

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