Glargoe Posted June 8, 2024 Share Posted June 8, 2024 Hi, I already made a post asking about this, but I realised it was in the wrong forum so I am reposting here. Apologies if reposts are not allowed. I am creating a client-side mod that adds different on-hit effects to weapons. For example, attacking with a spear makes a particle effect. The mod works fine on my own world, but I crash when I join a public world. I think this is because `inst.components.weapon` is not accessible by the client (when I print the keys of `inst.components`, I don't see weapon). Is there a way to fix this, or is there another method that I can use? I would prefer to keep the mod client-side as it is just a cosmetic mod. local function SpearEffects(inst, attacker, target) inst.components.weapon:SetOnAttack(function(inst, attacker, target) -- code for the effects -- breaks, attempt to index field 'weapon' (a nil value) end) end AddPrefabPostInit("spear", SpearEffects) Link to comment https://forums.kleientertainment.com/forums/topic/156669-help-client-side-mod-crashes-when-joining-a-public-server/ Share on other sites More sharing options...
_zwb Posted June 10, 2024 Share Posted June 10, 2024 Most components are not accessible on client side, you would have to make this a server mod, and check TheWorld.ismastersim at the start of post init, and return if false. Link to comment https://forums.kleientertainment.com/forums/topic/156669-help-client-side-mod-crashes-when-joining-a-public-server/#findComment-1722397 Share on other sites More sharing options...
Glargoe Posted June 11, 2024 Author Share Posted June 11, 2024 Thanks. Is it at all possible for a client-side mod to detect when a weapon is used? Link to comment https://forums.kleientertainment.com/forums/topic/156669-help-client-side-mod-crashes-when-joining-a-public-server/#findComment-1723085 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