Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the ideal method to make a frame move with the mouse? (Opinion)

Asked by
RoyMer 301 Moderation Voter
6 years ago
Edited 6 years ago

I was wondering which is the best way to make a frame's position change with the mouse's X and Y axis.

I have done it before using RenderStepped, I'm not sure whether it is the ideal method of doing so in 2018...??

(I'm asking for opinions)

0
Whatever works bro Kulh 125 — 6y
0
Trying to think of efficiency, less lag etc lol RoyMer 301 — 6y
0
I mean, other than detecting the mouse move, RenderStepped seems like a good way to update the frame’s position.  User#20279 0 — 6y

1 answer

Log in to vote
1
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
6 years ago

The Move event of PlayerMouse (Mouse.Move) is the best for this situation.

local Mouse = game.Players.LocalPlayer:GetMouse()
Mouse.Move:Connect(function()
    local X = Mouse.X
    local Y = Mouse.Y
    Frame.Position = UDim2.new(0,X,0,Y)
end)
0
hi buddy GingeyLol 338 — 6y
Ad

Answer this question