Remote event not sending player properly

When I print(findit), nil is printed. How do I make it send the player?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local plnm = ReplicatedStorage:WaitForChild("sendp")
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
  if _workspace.Up.VehicleSeat.Occupant ~= nil then
    local humanoid = seat.Occupant
    if humanoid then
      local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
      plnm:FireClient(player)
-------------------------------------local script below
local plnm = ReplicatedStorage:WaitForChild("sendp")
local seat = script.Parent
local findit
local function namereceive(player)
	findit = player
    print(findit)
end
plnm.OnClientEvent:Connect(namereceive)

Well for starters you’re not passing any parameter when you call the function on the last line, so when namereceive() is called it has nothing to print.

Ah, forgot to remove the brackets at the end when pasting it in. With them I had errors. I have removed them now so it reflects my code in studio. Ty. Do you know how can I make it pass the player properly?

You need to pass the player as the second argument in plnm:FireClient(player, player) ← like this.
As, the first argument only determines the player that will receive that event and is not passed to the client.

2 Likes

Just to add on to this, the player argument to :FireClient() indicates to the server which client should be fired.