I am attempting to make a script that sends entities the player is looking at to the server so the server can do something with that ( doesnt matter now).
This is my client script
function sendPropTable()
local Client = LocalPlayer()
local trace = Client:GetEyeTrace()
if trace.HitNonWorld then
net.Start("requestingPropOwner")
net.WriteEntity(trace.Entity)
net.SendToServer()
chat.AddText(Color(0,244,244),trace.Entity:GetName())
end
end
hook.Add("Think","sendPropTable",sendPropTable)
When I run it I get 2 errors:
attempt to call method ‘GetName’ (a nil value)
attempt to index local ‘name’ (a nil value)
Checking if the entity is valid using isValid always returns a true.
What am I doing wrong here?