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

What does GetMouse() means?

Asked by 10 years ago

I heard about this command like 20 or 30 times. I seen this command in a post that says " I am making a FPS game. I want to remove the backpack beacause I want to make weapons that aren't tools, using GetMouse() instead of tool". So I got confused In that Part. So GetMouse() means that a tool inside the player? If not please tell me what does it mean. Thank you for reading/helping. :)

2 answers

Log in to vote
1
Answered by 10 years ago

Hello there! GetMouse is a really simple thing where you can replace instances for another.

local Player = Game.Players.LocalPlayer
local Mouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
     print("Button 1 is down")
end)

The example above is a simple script to demonstrate what GetMouse is. The script is showing; whenever the LocalPlayer left clicks, and instance will be replaced. Like, if you want the LocalPlayer to left click for a gun, instead of having it in the backpack, he would have it in the script for whenever he clicks that certain key you script. In this case, the script is left click.

-Auroradom

0
So if I want to add a gun how would I do that? PlayingOBC 70 — 10y
0
Well, you'd have to use the command bar to insert the model into the script. So, it could be like; roblox.11453385 GetMouse.function() Auroradom 25 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

:GetMouse() is like connecting the mouse to the game as far as I know, it can be used like this

wait(1)
player = game.Players.LocalPlayer
Mouse = player:GetMouse()

Mouse.Button2Down:connect(function()
-- put the rest of code here.
end)


you can also use the Keydown to track when a key is pressed.

Answer this question