Not sure why i get "Unable to Cast value to Object" with fireclient

I am trying to fire to a client from a serverscript that gets the player id from a touched event that is ran over from car that has the player id in a value.

‘’

local ReplicatedStorage = game.ReplicatedStorage

local remoteEvent = ReplicatedStorage:WaitForChild(“Nitro_Splash”)

toggle = true
if toggle == true then
local Id = touched.Parent.Player.Value – i do get the right PlayerID
Player = Id
remoteEvent:FireClient(Player)
end
‘’

i have looked at other topics and didn’t solve the problem.

Your Player variable isn’t a player object. You can do something like

remoteEvent:FireClient(game.Players:GetPlayerByUserId(tonumber(Player))) assuming your Player variable is the UserId.

1 Like

Thanks that worked i had no idea that it had to be a player object.