Radar chart points in the wrong spot

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!
    trying to make a radar chart for stats
  2. What is the issue? Include screenshots / videos if possible!
    the points are put in the wrong spot

  3. What solutions have you tried so far? Did you look for solutions on the Creator Hub?
    change the orange parts’ parents, using position/absoluteposition, haven’t figured out or found any other solutions yet
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

using egomoose’s triangle function and using invisible frames (partially transparent in images for testing) but the points are being put in the wrong spot, the grey frame in pic 1 should be in the middle of the chart , same with the point of the orange part in pic 2 and the shaped part should be around it in the first part of the chart,
heres the code for the test frame in image 1

local chart = script.Parent
local menu = chart.Parent
local mid = menu:WaitForChild("Mid")
local test = Instance.new("Frame")
test.Parent = menu
test.AnchorPoint = Vector2.new(0.5, 0.5)
test.Position = UDim2.new(mid.AbsolutePosition)
test.Size = UDim2.new(0.1,0.1)

if theres any other important info i forgot lmk obv

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

I think you meant to do this:

test.Position = mid.Position

worked for the test frame but since i need to use them in some math it doesnt work without it being vector2 (i only used udim2 there since it was for the test frame)

I need more clarification on the math you’re doing that can only work with Vector2s

i mean i THINK it only works with vector2s, p sure bc using smth else gives an error, tried udim2 and got “invalid argument #2 (Vector2 expected, got UDim2)”, like i said im using egomoose’s triangle function, other than that i used some to get where the points for the stats should be by getting what percent of all stats together each stat is and the distance from the start to end of the chart,

-- distance from start to end for strength
local DistanceSTR = Vector2.new(STREnd.AbsolutePosition.X - STRStart.AbsolutePosition.X, STREnd.AbsolutePosition.Y - STRStart.AbsolutePosition.Y)

--gets total of stats and percent, note im only putting strength as example here but if the rest for some reason are necessary lmk but theyre abt the same 
local STR = Stats:WaitForChild("base STR")
local stat_total = STR.Value + AGI.Value + INT.Value + VIT.Value + DEX.Value
local strpercent = (STR.Value/stat_total)

calculates where the points go for each stat
local Points = {
		Vector2.new((STRStart.AbsolutePosition.X + (DistanceSTR.X*strpercent)), (STRStart.AbsolutePosition.Y + (DistanceSTR.Y*strpercent)));
-- rest of the points for the stats go here

lmk if u need any other info

Edit: it did work without vector2 i jst didnt realize bc i wrote it wrong and gave something vector2 somewhere else when it didnt need it so then it expected it everywhere else that was used in math with that part ig? if that makes sense idk, still not working perfectly so ill try some stuff rq to fix that then come back to update


heres what happens now, not as far off as before but obvs not where it should b

also doesnt seem to scale right but im kinda just hoping it fixes when i figure out how to get it in the right spot anyway

still having issues w it, its a bit better now but like, still wont stay in the right spot

I apologize for the late response but did you manage to fix it? If not, I’m assuming you can solve this by converting the AbsolutePosition of the middle position to a Position that the orange hexagon can use.

Might be useful: Convert AbsolutePosition to Position - #2 by ThatOneNoobOnTheTeam

If the blue hexagon is an image instance, parent the orange hexagon to the blue hexagon, set the anchor point of the orange hexagon to (0.5,0.5) and then set the position to {{0.5,0},{0.5,0}}. This should fix the centralising without changig the script.
For the extreme points of the hexagon, for example STRend, will always be at the position x = 0.5, y = 0.1 (in scale, not pixels). get STRstart’s position in UDIM2 scale (allows it to scale for different devices) and then do the maths (lerp or similar) to figure out how far in the triangle should stretch e.g: 0% = STRstart, 100% = STRend
If this doesn’t make sense, let me know and I will try to clarify.

tried this but it just either says dot or magnitude is not a valid member of udim2 since the triangle function uses those, changing udim2.fromscale to scale or jst doing return frameRelativePos / containerAbsSize jst makes one of the positions negative so its not on screen, i could jst be using or understanding it wrong, does this need to be udim2.fromescale? is there anyway to do that with dot: and .magnitude still working?

here is a comparison of the old one (the one that gets the longer point) and the new one when i do return frameRelativePos / containerAbsSize (the one on the left that dissapears when all stats are 0 for some reason

a little confused here, if you mean the frames im using to find the position the points of the triangles should be in theyre already children of the blue hexagon and done in scale, my issue is just that the points of the triangles arent going where theyre supposed to. im generating 10 triangles based on these points so putting them in the middle like u suggested wont have the right shape. if im just not understanding the suggestion lmk

Try placing the anchorPoint of the triangles to the corner that will be placed in the center, then have all the triangles go to the same position in the middle.
Could you give us the position of the background (blue) pentagon so I know how it scales? It would help me understand where the orange triangles should be centred.

Are the triangles made with a script or are they already created but the script modifies them?

Sorry about the questions, I may be misunderstanding your problem

dw abt the questions lol id prefer you ask to understand the issue more than jst not respond at all lol,

the blue shapes position is {0.23, 0},{0.651, 0} with an anchor point of 0.5, 0.5

the triangles are made with the scripts, i just have frames placed around on top of the blue part to see where the points should be

Can’t you have the triangles premade and then modify them? it will be placed correctly in the right position and then you can modify the scale to show the stats