#mouse.Target is my player on the Server, but correct on the client

1 messages · Page 1 of 1 (latest)

sudden shale
#

local script

local tool = script.Parent
local mouse = game.Players.LocalPlayer:GetMouse()

tool.Activated:Connect(function()
    if mouse.Target.Name == "FarmingTile" then
        script.Parent.RemoteEvent:FireServer(mouse.Target)
        tool:Destroy()
    end
end)

script

local tool = script.Parent

tool.RemoteEvent.OnServerEvent:Connect(function(target)
    target:SetAttribute("Crop",tool:GetAttribute("Crop"))
    tool:Destroy()
end)

im trying to make a seed system, but it keeps throwing up a different mouse.Target on the client/server side

#

this is really confusing me, cause not only is the same thing somehow different

#

its also a player (which isnt an object)

ocean yacht
#

I wonder if it has to do with mouse.TargetFilterr?

#

Oh wait

#

The remote event, the first parameter is Player

#

Any following parameters are the arguments sent using :FireServer

#
 function(Player: Player, ...: any)
end```
#

script

local tool = script.Parent

tool.RemoteEvent.OnServerEvent:Connect(function(player, target)
    target:SetAttribute("Crop",tool:GetAttribute("Crop"))
    tool:Destroy()
end)
#

Here's the updated code

#

Bcs even if you fire a remote event without any arguments, Player will always be the first parameter

sudden shale
#

that would make sense

#

thats it returning a player