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

When adding a circle GUI, how do I make the mouse consigned to the circle?

Asked by 2 years ago

To elaborate more, I'm working on a fighter jet and I'd like to find how to make sure the mouse can't move out of a small circle in the centre of the screen (hopefully you see what I mean)

Any solutions would be helpful!

1 answer

Log in to vote
0
Answered by
Puppynniko 1059 Moderation Voter
2 years ago

this will only show the moving box or circle

01local Uis = game:GetService("UserInputService")
02local RunS = game:GetService("RunService")
03local Frame = script.Parent.Frame
04local Sensitivity = 1 --above one for more sensitivity i think
05RunS.Stepped:Connect(function()
06    Uis.MouseBehavior = Enum.MouseBehavior.LockCenter
07    Uis.MouseIconEnabled = false
08    local Delta = Uis:GetMouseDelta()
09    Uis.MouseDeltaSensitivity = Sensitivity
10    --script.Parent.Frame.Position = UDim2.new(.5,-Delta.X,.5,-Delta.Y)
11    game:GetService("TweenService"):Create(Frame,TweenInfo.new(.1),{Position = UDim2.new(.5,-Delta.X,.5,-Delta.Y)}):Play()
12end)
0
thanks, i'll test it out Valkyrie1277 28 — 2y
Ad

Answer this question