draw.RoundedBox on Viewmodel?

Hello,

I have made an TFA Swep and want to draw Something on it like a Roundedbox oder a Text.

Does anybody know how to do this?

Thx that helped me a bit. But now i just want to Show the Roundedbox only when i am Holding a Certain SWEP.
Do i have to write the Code in the SWEP:Initialize function because when i am doing an If Statement like if LocalPlayer():GetActiveWeapon:GetClass():IsValid(“SWEPCLASS”) it give me an error like IsValid is a nil value

You can use some render hook and just check if the current weapon is the one you are looking for. (SWEP:GetClass())

The current error you get is caused by calling IsValid() on GetClass() which returns a string. If you want to check whether a weapon/entity is valid, use IsValid(entity).

Ok Thx for your help so far. But can you give me an idea how to draw The Box on the weapon and not on my Eyetrace position?

You might be able to use GM:PostDrawViewModel - Garry's Mod Wiki for that. The first argument is the viewmodel entity. I am not sure how easy it is to get the correct position you want to draw the box at. I’d try finding a position relative to one of the viewmodel’s attachment points using Entity:GetAttachment - Garry's Mod Wiki.

Someone correct me please if I’m overcomplicating stuff.

example

For everyone who sees this Post: This is an Example how i want the Roundedbox do draw on the Weapon