The error states that plr must be an object, even though when I print out the player before firing, it says my username. Why is this happening and how can I fix this? P.S. The if statement is inside of a modulescript function and fires every 1 second in a while true do loop.
if seat:FindFirstChild("SeatWeld") and seat.SeatWeld.Part1.Parent.ClassName == "Model" then plr = game.Players:GetPlayerFromCharacter(seat.SeatWeld.Part1.Parent) print(plr) Sitting = true SitEvent:FireClient(plr,Sitting,seat) -- here else Sitting = nil SitEvent:FireClient(plr,Sitting,seat) end
Servers and Clients
If you are using a server script to :FireClient() and using a server script to use .OnClientEvent, it will not work.
You need to FireClient from servers, and receive ClientEvents from the Client.
Hope this helped.