Jump to content

Recommended Posts

Hello, 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 when 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 `inst.components`, I don't see weapon).

Is there a way to fix this? Or is there another method 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
    end)
end

AddPrefabPostInit("spear", SpearEffects)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...