How can I move a GUI to the position of the users cursor?
Make a new frame, and then
change the properties of a frame to:
- AnchorPoint: 0.5, 0.5
- Size: {0.06, 0},{0.119, 0}
Afterwards, copy and paste this code in a new local script inside of the frame.
Code:
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local button = script.Parent
runService.RenderStepped:Connect(function() -- constantly updates based on frames
button.Position = UDim2.new(0, mouse.X, 0, mouse.Y) -- changing the offset values
end)