Hello. You guys, i need help with something.. i am trying to get Mouse.Target With RemoteEvent. The thing is that i am not good at RemoteEvents And I dont know how To Send them to serverscripts. This is a example i did:
LocalScript:
local mouse = game.Players.LocalPlayer:GetMouse()
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent:FireServer(mouse.Target)
Server:
local Event = game.ReplicatedStorage.RemoteEvent
Event.OnServerEvent:Connect(function(player,mouse)
mouse.Target.Parent.Character.Humanoid:TakeDamage(40)
end)
Now The error says "Target is not a vaild member of Part". Help

7 comments
i edited the question just incase some problems
You should use raycasting. It usually solves problems like yours.
im sorry but i dont really know raycasting. can you explain? @Dovydas1118
you're already passing the mouse target, just remove .Target from the server script
ill test
it prints. But it does not Damage The player. @Leamir
remove the .Character also, mouse.Parent (on the server script) is already the character