Yay another simple script error

Expect me to post on this forum a lot about my small script errors.

For practice I’m making a tool that will create a part where ever the mouse is. I’ll add the part creation script later though I just wanted to make sure the game can find the mouse. I wrote this simple script for it, (the local boom part is going to be for later.) There is no error lines but I get an error message:

Workspace.Tool.Handle.Script:3: attempt to index nil with ‘GetMouse’

local boom = workspace.Tool
local player = game.Players.LocalPlayer
game.Localmouse = player.GetMouse

	print ("Mouse Found")

What did I do wrong?

1 Like

am not sure but isnt it :GetMouse() ?

1 Like

Ye but It is underlined in red

maybe try
local mouse = player:GetMouse() and

for your event mouse.Button1Up:Connect(function()

to get the mouse just type
local mouse = Player:GetMouse()

Put this in a local script so it works. Adding on, the mouse is not an instance and it’s basically the client so the server can’t access it.

Ya ok I went through it but now it says GetMouse is not a valid member of DataModel “Classic Baseplate”

you’re not supposed to put “game.” on the start

After fixing everything it still says GetMouse isnt a proper data model

can you send me the code ?
also is this a local script or a normal script ?

Its a local script

local player = game.Players.LocalPlayer
local mouse = game:GetMouse()

	print ("Mouse Found")


local mouse = game.Players.LocalPlayer:GetMouse()

dont do this

local mouse = game:GetMouse()

do this

local mouse = player:GetMouse()

Ye that’s what I did at first but someone told me to put game.GetMouse()

Ok so now it says Connect is not a valid member of PlayerMouse “Instance”

mouse:Connect() isn’t really a thing
what are you trying to achieve from that line ?

1 Like

connecting a function to the script… Sorry I’m just a noob at scripting :sob:

no problem, when do you want that function to run ?

I want it to print Mouse Found when the script successfully locates where the mouse is located.

If you want to get the mouse position on 2D try using this:

local Players = game:GetService("Players")
local Client = Players.LocalPlayer
local Mouse = Client:GetMouse()

print(Mouse.X, Mouse.Y)