I have tried to get a mouse but it is not working here is my code:
local tool = script.Parent
tool.Activated:Connect(function()
local playername = tool.Parent.Name
local player = game.Players:FindFirstChild(playername)
local Mouse = player:GetMouse()
local mouse = Mouse.Hit
local bullet = Instance.new("Part")
bullet.Anchored = bullet
bullet.CanCollide = false
bullet.BrickColor = BrickColor.new("Really red")
bullet.Material = ("Neon")
bullet.Parent = workspace
bullet.Position = tool.Handle.Position + Vector3.new(0, 0, 1)
bullet.CFrame = CFrame.new(bullet.CFrame.p,mouse.p)
end)
the error I get is:
Workspace.Pistol.Script:7: attempt to index local 'Mouse' (a nill value)

2 comments
Please format your code using the "lua" button (edit the question so it is clear to read), Also is this a local script or server script?
This is a script inside of the tool