Hey
im making a script where we can shoot balls but the ball position and direction will depend on where
the “cursor frame” is on the screen i dont know if its possible to get the 2D position of the red frame that’s why im asking it here
local position = game.StarterGui.ScreenGui.Frame.Position
while true do wait()
local ball = game.ReplicatedStorage:WaitForChild("Ball")
local clone = ball:Clone()
ball:Clone()
clone.Parent = workspace
clone.CFrame = part.CFrame * CFrame.new(0, -5, 0)
local direction = position
local forceMultipliter = 410 * ball:GetMass()
clone:ApplyImpulse(direction * forceMultipliter)
Using Frame.Position will give you a UDim2 value (which contains 4 values), if you want a 2D position from the GUI you will have to grab just an x and y value from the frame. To easily do this you can just grab the Position’s X scale value (Frame.Position.X.Scale) and Y scale value. If you have any offset values set on your Gui, you’ll have to incorporate that to get your 2D x and y values.