Help! Mouse = Nil!

So i want to make a game where you plant seeds, i have this seed tool which when activated uses the mouse.Target to get the part which the mouse is pointing at.
now when i send that info to the server it says nil.

code:

Connection.OnServerEvent:Connect(function(plr,Mouse)--Connection Is The Remote Event
	print(Mouse.Target)--Prints "Nil"
--RestOfCode
end)

Client Code:


script.Parent.Activated:Connect(function()
	print(Mouse.Target)--Prints "BasePlate"
	Event:FireServer(Mouse)--Event Is The RemoteEvent.
end)

Thanks In Advance!

The Mouse object is not replicated, it’s only available on the client. What do you need the player’s mouse for on the server?

He just said its for a seed tool lol

It’s For When I Get It’s Target I Can Check If It Is A Valid Part To Plant On, Then Clone A Flower From ReplicatedStorage To Put It On The Part.

Is that all the code? Do you got a variable for the mouse?

You should code that logic on the client, and then tell the server. Or you can just tell the server what Mouse.Target is!

1 Like

Yea it’s

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

You are passing the mouse as an argument try passing the target:

script.Parent.Activated:Connect(function()
	print(Mouse.Target)
	Event:FireServer(Mouse.Target)
end)
2 Likes

Yes.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.