I’ve never really tried to make a hunger type of system so most of it is just trial and error I guess, I was told to do it based off movement etc so Im using a timer if the player is moving for 5 minutes and stops when they stop moving (code has problems) so I need a little help I guess.
- If the player stops. The timer will completely pause and I need to start it again once they keep moving
- I get this error in the init.lua (im using a PlayerSpawn hook)
[ERROR] gamemodes/wasteland/gamemode/init.lua:24: attempt to call method 'StartHunger' (a nil value)
I’m not getting very far at this right now so all help is appreciated.
local meta = FindMetaTable("Player") function meta:StartHunger(ply) local CPlayer = LocalPlayer() if ply:GetVelocity():Length() > 0 then timer.Create("Hunger", 300, 0, function() ply:Kill() elseif ply:GetVelocity():Length() =< 0 then timer.Pause("Hunger") print("Timer Paused ") end end) end end
Im still not sure whether I need the player object for this too. Could I just do it all serverside? (Not very good at this stuff)