Mouse.hit cant be found when remotevent.OnServerEvent(func(player)

  1. I want to get the cframe from mouse.hit in a server script using a remote event

  2. 11:35:19.817 Workspace.RemoteEv.PlacementS:3: attempt to index nil with ‘Hit’ - Server - PlacementS:3

script.Parent.Place.OnServerEvent:Connect(function(player)
	local mouse = player:GetMouse()
	local hit = mouse.Hit
1 Like

It’s kind of simple, this is the script that you would find the solution

first, this is a server script sided :

script.Parent.Place.OnServerEvent:Connect(function(player,mouse)
       local MouseCFrame = mouse
end)

Second, here’s the local script that fire the remoteEvent

myRemoteEvent:FireServer(mouse.Hit) -- replace myRemoteEvent with your remote event

Server script sided cannot be used to find player’s mouse CFrame and it only works on your local script side

2 Likes

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