local tool = script.Parent
local rs = game.ReplicatedStorage
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if mouse.Target and mouse.Target.Parent then
if(mouse.Target.Name == "Grass") then
local Mpos = mouse.Hit.Position
local NewHole = rs.BrownHole:Clone()
newHole.PrimaryPart.Position = Mpos
newHole.Parent = workspace
end
end
end)
end)`
You cannot pass objects as arguments, and even if you did this would still not work as the players mouse does not replicate to the server. All your code here would do is return nil.
You’re right for the second part since Mouse isn’t replicated to the server, but you can pass objects as arguments… sorry for the misleading information. Another alternative is only to pass other values I guess, such as the mouse position.
I’d like to say it’s also probably never a good idea to use InvokeClient.
For something like this, a RemoteEvent’s FireServer would do just fine.
In response to OP, you would simply pass the property you want from the mouse as an argument when calling FireServer.
In this case you would put something along the lines of remoteEvent:FireServer(mouse.Hit.Position) in your Button1Down event and have the server handle the rest.