Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local character = player.Character
- local mouse = player:GetMouse()
- local gui = player.PlayerGui.GUI
- local from = Vector2.new(0,0)
- local line = Instance.new("Frame", gui)
- mouse.Move:connect(function()
- local to = Vector2.new(mouse.X, mouse.Y)
- local vector = to-from
- local angle = math.atan2(vector.Y, vector.X)
- local distance = vector.magnitude
- local half = distance/2
- line.Size = UDim2.new(0,distance,0,1)
- line.Position = UDim2.new(0, from.X + half*math.cos(angle), 0, from.Y + half*math.sin(angle))
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement