SetModelScale and GetModelScale

I’m fairly new to Lua and trying to improve my knowledge by fixing up broken gamemode and learning new functions and I’ve hit a brick wall

function META:Grow()
for _,ply in pairs(player.GetAll()) do
if self:GetPos():Distance(ply:GetPos()) < 200 then
if ply.Stank == nil then
ply.Stank = {Level = 1,}
ply.Stank.Level = ply.Stank.Level + 1
timer.Simple(math.random(10,30),function() if ply:IsValid() then ply:EmitScent() end end )
if self:GetModelScale().x < 10 then
self:SetModelScale(self:GetModelScale() + Vector(.05,.05,.05))
timer.Simple(math.random(10,30),function() if self:IsValid() then self:Grow() end end )

Now I believe ive fixed the SetModelScale issue by putting this in the initial cl_init

function Entity:SetModelScale(scale)
local mat = Matrix()
self:EnableMatrix(“RenderMultiply”, mat)

But GetModelScale from what I’ve read now works completely different as well
Any help would be appreciated
Thanks Guys

What are you asking us to do?

Probably just want to do like
function Entity:SetModelScale(scale)
self.fModelScale = scale
function Entity:GetModelScale()
return self.fModelScale or 1

I was trying to find a replacement for GetModeScale.

And Donkie that worked perfectly thanks! :smiley:

Mind explaining to me what that did? as I said I’m doing this to learn.

The arguments for SetModelScale have been changed. It no longer takes a vector, it takes two floats (I believe)
SetModelScale(float Scale, float TimeToSize)

The first float is what you wish to scale to (2 for 2x as large, .5 for 1/2 as large) and TimeToSize is the time it takes for the model to reach that size.

Pros: Easier to use
Cons: Cannot scale as easily on an individual axis

Unsure about GetModelScale

please stop shitposting everywhere, you dont know lua anyways.