Maxsar 1 Report post Posted August 15, 2021 So i added custom component to character and its crashing when: i enter cave i load existing world - creating new world is fine but when i disconnect and resume it teleports my character to some random spot and after few seconds crash server. here is code for component: --blood.lua local Blood = Class(function(self, inst) self.inst = inst self.max = 100 self.current = 0 end) function Blood:OnSave() return {currentblood = self.current} end function Blood:OnLoad(data) if data.currentblood then self.current = data.currentblood self:DoDelta(0, true) end end --Ustawia aktualna wartosc bloodpoints function Blood:SetCurrent(amount) self.current = amount end function Blood:GetCurrent() return self.current end return Blood and i add component to character this way inst:AddComponent("blood") its probably something with saving or loading, maybe? idk Share this post Link to post Share on other sites
ZeroRyuk 4 Report post Posted August 18, 2021 You're calling DoDelta in your OnLoad, but you don't have a function for it. Share this post Link to post Share on other sites
Maxsar 1 Report post Posted August 18, 2021 OMFG IM DUMB THANK YOU!!!!!! I WAS FIGTHING THIS FOR A WEEK NOW Q.Q THANK YOU SO MUCH 1 Share this post Link to post Share on other sites
ZeroRyuk 4 Report post Posted August 18, 2021 You're welcome lol 1 Share this post Link to post Share on other sites
Maxsar 1 Report post Posted August 18, 2021 (edited) Ok it doesnt save values after server restart. What ma i doing wrong this time? xD edit. fixed it. Edited August 18, 2021 by Maxsar Share this post Link to post Share on other sites