Is there anything like Mouse.Move
for UserInputService
? I know there's InputChanged
but it doesn't seem to work for me. I'm trying to create a building tool and it would be better if it's all UserInputService
. (Line 45.) This is what i've done so far:
01 | local UserInputService = game:GetService( "UserInputService" ) |
02 |
03 | local mouse = game:GetService( "Players" ).LocalPlayer:GetMouse() |
04 | mouse.TargetFilter = script.Parent -- I wrote script.Parent because it's in StarterCharacterScripts |
05 |
06 | local wasAnchored |
07 |
08 | local wasCanCollide |
09 |
10 | local targetPart |
11 |
12 | local selectionBox |
13 |
14 | local mouseMove |
15 |
I'll just say that I don't know how you can do this with UserInputService
, but mouse.Move
already seems to work fine.
I tested out your script. Everything works well except for the movement of the targetPart. I don't know if that's why you wanted to use something other than mouse.Move
. I used TweenService
in your onMouseMove function (on line 43), and the movement was fixed.
When I let go of the part which is where InputEnded
runs, the targetPart went back to its original position. That was fixed on line 53.
01 | local UserInputService = game:GetService( "UserInputService" ) |
02 |
03 | local mouse = game:GetService( "Players" ).LocalPlayer:GetMouse() |
04 | mouse.TargetFilter = script.Parent -- I wrote script.Parent because it's in StarterCharacterScripts |
05 |
06 | local wasAnchored |
07 |
08 | local wasCanCollide |
09 |
10 | local targetPart |
11 |
12 | local selectionBox |
13 |
14 | local mouseMove |
15 |
I think this might be what you mean, if it is you can edit it to your liking
01 | Player = game.Players.LocalPlayer |
02 | Mouse = Player:GetMouse() |
03 |
04 | Gui = Player.PlayerGui.GunShop |
05 |
06 | InfoGui = Gui.InfoHover 12 |
07 |
08 | Module = require(game.ReplicatedFirst.GunInfo) |
09 |
10 | Entered = false |
11 |
12 | script.Parent.MouseEnter:connect( function () |
13 | Entered = true |
14 | InfoGui.Visible = true |
15 |