Playermodel not changing

I’ve created a SWEP that turns the player into a watermelon on deployment, and explodes on primary fire, but apparently, whenever it is deployed, I just show up as two errors. I predict one error is the viewmodel, and one is the worldmodel. How would one go about properly changing his model?

Here’s my code in the shared file:


	//Show debug info?

	
local debug = true
 


//----------------------------------------------------

//Author Info

//----------------------------------------------------

SWEP.Author             = "Toastermach10"

SWEP.Contact            = "branmanballer34@aol.com"

SWEP.Purpose            = "To confuse and explode curious people"

SWEP.Instructions       = "Equip to become a watermelon. Primary fire to explode."

//----------------------------------------------------
 
SWEP.Spawnable = true

SWEP.AdminSpawnable = true
// First person Model

SWEP.ViewModel = "v_bugbait"
// Third Person Model

SWEP.WorldModel = "w_bugbait"
// Weapon Details

SWEP.Primary.Clipsize = -1

SWEP.Primary.DefaultClip = -1

SWEP.Primary.Automatic = false

SWEP.Primary.Ammo = "none"

SWEP.Secondary.Clipsize = -1

SWEP.Secondary.DefaultClip = -1

SWEP.Secondary.Automatic = false

SWEP.Secondary.Ammo = "none"

// Sound
local 
ShootSound = Sound ("Metal.SawbladeStick")
 
 

//--------------------------------------------------

// When it reloads | Nothing

//--------------------------------------------------

function SWEP:Reload()
	
	if debug then
		
		print("Reload")
	
	end
 

end
 
 

//--------------------------------------------------

// Each frame when the Swep is active | Nothing

//--------------------------------------------------

	function SWEP:Think()

end
 

//--------------------------------------------------

// When Swep is taken out | Turns player to melon

//-------------------------------------------------


function SWEP:Deploy()
	
	self.Owner.oldmodel = self.Owner:GetModel()
	

	self.Owner:SetModel("props_junk\watermelon01.mdl")

end



//--------------------------------------------------

// When Swep is put up  |  Changes to original model

// -------------------------------------------------


function SWEP:Holster()

	if self.Owner.oldmodel then
		
		self.Owner:SetModel(self.Owner.oldmodel)
		
		self.Owner.oldmodel = nil

	end
end


//--------------------------------------------------

// When the player shoots | Explodes player

//--------------------------------------------------

function SWEP:PrimaryAttack()

	
	if debug then

		print("Primary Attack")

	end

		standingpoint = self.Owner:GetPos()
		
	
		
		local explode = ents.Create( "env_explosion" )

	explode:SetPos( standingpoint )

	explode:SetOwner( self.Owner )

	explode:Spawn()
	explode:SetKeyValue( "iMagnitude", "220" )

	explode:Fire( "Explode", 0, 0 )

	explode:EmitSound( "weapon_AWP.Single", 400, 400 )
end
 
 

//--------------------------------------------------

// When the player uses secondary attack | Nothing

//--------------------------------------------------

function SWEP:SecondaryAttack()

	if debug then

		print("Secondary Attack")

	end

	
	self.Weapon:EmitSound(ShootSound)

end


//-------------------------------------------------

// When player takes damage | Eliminates damage

//-------------------------------------------------

function self.Owner.GM:EntityTakeDamage( ent, inflictor, attacker, amount, dmginfo )

 
	if ent:IsPlayer() then

 
		dmginfo:ScaleDamage( 0 )

 
	end


end 

Commonly, lua interprets a backslash as something called “backslash escaping”

What this means, is that the letter directly after the backslash isn’t parsed as a string, and that is why it’s useful for using escape characters such as
or \0.

Here’s a quick fix.

self.Owner:SetModel(“props_junk\watermelon01.mdl”)

or

self.Owner:SetModel(“props_junk/watermelon01.mdl”)

And for the view model/world model, you must include the full path to the model, as well as the .mdl on the end.

Thanks