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

Is there anything like Mouse.Move for UserInputService?

Asked by 4 years ago
Edited 4 years ago

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:

01local UserInputService = game:GetService("UserInputService")
02 
03local mouse = game:GetService("Players").LocalPlayer:GetMouse()
04mouse.TargetFilter = script.Parent -- I wrote script.Parent because it's in StarterCharacterScripts
05 
06local wasAnchored
07 
08local wasCanCollide
09 
10local targetPart
11 
12local selectionBox
13 
14local mouseMove
15 
View all 62 lines...

2 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago
  1. I'll just say that I don't know how you can do this with UserInputService, but mouse.Move already seems to work fine.

  2. 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.

  3. 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.

01local UserInputService = game:GetService("UserInputService")
02 
03local mouse = game:GetService("Players").LocalPlayer:GetMouse()
04mouse.TargetFilter = script.Parent -- I wrote script.Parent because it's in StarterCharacterScripts
05 
06local wasAnchored
07 
08local wasCanCollide
09 
10local targetPart
11 
12local selectionBox
13 
14local mouseMove
15 
View all 65 lines...
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

I think this might be what you mean, if it is you can edit it to your liking

01Player = game.Players.LocalPlayer
02Mouse = Player:GetMouse()
03 
04Gui = Player.PlayerGui.GunShop
05 
06InfoGui = Gui.InfoHover12
07 
08Module = require(game.ReplicatedFirst.GunInfo)
09 
10Entered = false
11 
12script.Parent.MouseEnter:connect(function()
13    Entered = true
14    InfoGui.Visible = true
15 
View all 31 lines...
0
No, I meant a tool that grabs parts and can place it somewhere. youtubemasterWOW 2741 — 4y
0
oh yh that wont work FluffySheep46209 369 — 4y

Answer this question