Need help making a drawing into a part

So I want to make a game where you draw something on a frame and then it makes your drawing into a part. So far I made the drawing part with the frame. The issue I’m having is the actually using that drawing the user made into a part. Here is my script:

local frm = script.Parent
local isDrawin = false
local tlPixel = frm.AbsolutePosition

local function makePoint (x, y)
local pnt = Instance.new(“Frame” , frm)
local roundIt = Instance.new(“UICorner”, pnt)
roundIt.CornerRadius = UDim.new(.5, 0)
pnt.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
pnt.Size = UDim2.fromOffset(45, 45)
pnt.Position = UDim2.fromOffset(x, y)
pnt.AnchorPoint = Vector2.new(.5, .5)
pnt.BorderSizePixel = 0
end

frm.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isDrawin = true
elseif input.KeyCode == Enum.KeyCode.Space then
local pnts = frm:GetChildren()
for i, v in pairs(pnts) do
if v:IsA(“Frame”) then
v:Destroy()
end
end
end
end)

frm.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isDrawin = false
end
end)

frm.InputChanged:Connect(function(input)
if isDrawin and input.UserInputType == Enum.UserInputType.MouseMovement then
makePoint(input.Position.X-tlPixel.X, input.Position.Y-tlPixel.Y)
end
end)

That is in a Frame in a ScreenGui in the Startergui

1 Like

Make instance part, then clone your frame and put it in surface gui, surface gui has to be parented with part and that’s it.

I will try this and update if it works, thank you