[GMOD] [Support] Script Errors with cl_init.lua Line 82

I was playing on vessel (can provide link to map if needed), and as a body dropped, I landed to ID it and I was faced with these errors


Any ideas?

That means the view model doesn’t have an attachment. Do a validity check on the attachment

Don’t know lua. How would I do this? Tried looking it up, and it seems I may have to include some type of “Entity/IsValid” or “Global/IsValid”?

Thanks for the quick response.

if not IsValid( attachment ) then ... end

Either return or go to the next portion of the code

So at Line 83 I should add that bit you posted?

Yes, but replace the … with what you want to do in there

I don’t know WHAT I’m supposed to do in there lol Like I said, I’m not much of a coder. If you could point me to where I need to go.

Wrap StartPos = attachment.pos in and IsValid check like code_gs said

The problem occured with the same file again. This time I found a commonality. I noticed the errors occured when a player launched upwards with the grapple hook. Last time I faced the error, I was descending with the grapple hook.

This specific error seems to call out the grapple hook and instead of calling out line 82, it’s calling line 87 (both marked below).

I have taken the above suggestions now and applied it. I’ll reboot and see if I see the error happen again.

New error:


Current cl_init.lua:


Hope I did this correctly.

EDIT: Now I’m getting spammed with the below error in regards to line 88 of the above code. I am reverting back to the original.


EDIT 2: This model seemed to have fucked the grapple big time. The script error seems to not bve showing up anymore, although they were originally happening before I installed this model anyway. But for now Ill just wait it out. Cant seem to force it http://steamcommunity.com/sharedfiles/filedetails/?id=389979292

Dunno if this will work, but replace lines 88 and 89 with:
StartPos = Owner:GetAttachment(3) and Owner:GetAttachment(3).Pos or nil
if !IsValid(StartPos) then return end