GetDriver() Question

I’ve looked at the lua wiki for help on this, but I can’t seem to solve it.

I’ve traced the players view, and I store the data in a variable called tr, here’s my code:


if tr.Entity:IsVehicle() then // This line here is run
if tr.Entity:GetDriver():IsPlayer() then // This line here spits an error ([cl_init.lua:477] attempt to call method 'GetDriver' (a nil value))
//more code
end
end

I wondering what I’m doing wrong, I’ve also tried GetVehicle(), however I’m obviously missing something…

Edit: It’s server sided lua and I’m running it client side, my bad, wondering how I can achieve the same result with client side lua now?

Edit2: Solved it myself, thanks anyways :stuck_out_tongue: