LordFrz Posted April 16, 2018 Share Posted April 16, 2018 How would I run code after a player loaded in, for example setting max health? The api example shows this, but it seems to be outdated. function ModifyStartStats(player) player.components.health:SetMaxHealth(333) end AddSimPostInit(ModifyStartStats) I tried this, but got the same issue of nil value for player. function ModifyStartStats() GLOBAL.ThePlayer.components.health:SetMaxHealth(333) end AddGamePostInit(ModifyStartStats) Thank. Link to comment Share on other sites More sharing options...
ksaab Posted April 17, 2018 Share Posted April 17, 2018 Use PlayerPostInit instead of AddSimPostInit: AddPlayerPostInit(function(player) player.components.health:SetMaxHealth(50) -- all players if player.prefab = "wendy" then -- specific characters inst.components.combat.damagemultiplier = 1 end end) Link to comment Share on other sites More sharing options...
LordFrz Posted April 17, 2018 Author Share Posted April 17, 2018 Thanks a bunch Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now