#How to convert Vector2 into UDim2

1 messages · Page 1 of 1 (latest)

static trout
#

I'm trying to make a drawing system for my game, and I came up with this script. When I try and use it though, the gui's (ink) position is set a decent amount off from where the mouse is.

local RunService = game:GetService("RunService")
local plr = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
RunService.RenderStepped:Connect(function()
    local mousepos = UIS:GetMouseLocation()
    if game.Players.LocalPlayer.MousePressed.Value == true then
        local ink = game.ReplicatedStorage.Ink:Clone()
        local relativePosition = mousepos - ink.AbsolutePosition
        ink.Parent = plr.PlayerGui.Canvas.Ink.Canvas
        ink.Position = UDim2.fromOffset(relativePosition.X, relativePosition.Y)
        ink.Visible = true
        print("x")
    end
end)
stark fern
#

oh

dreamy glacier
#

if you want to see my whole drawing script lmk

static trout
#

gotcha

#

although i wld rather like to figure it out by myself

#

i just want the key concepts

dreamy glacier
static trout
plain siloBOT
#

studio** You are now Level 8! **studio

static trout
#

do you want a recording

dreamy glacier
static trout