Help with stun immunity for killer

I’m working on a game where survivors survive against a killer, and I’ve run into a problem with the stun mechanic. Previously, my stun system worked like this: when a survivor used their ability, a local script would send a signal to the server, which would then stun the killer if they were hit by the ability’s hitbox.

Now, I want to add certain killers who cannot be stunned, so before applying the stun effect, I need to check if the killer is immune to it. I also need to be able to change stun immunity variable through the killer’s ability script.

I tried using BoolValue, but I couldn’t get it to work properly. Is there a better way to implement this?

1 Like

A boolvalue that determines whether or not the killer can be stunned is the way to go

1 Like

You can use a module script to check if a certain killer is immune or not to a stun effect.

Example :

local ImmunitiesModule = {}

ImmunitiesModule.KILLER_TYPE_A = {LIST_OF_STUN_IMMUNITIES_IN_STRING}

-- example
ImmunitiesModule.Thobbie = {"Taser stun"}

return ImmunitiesModule

And when a server checks for an certain killer’s immunities :

function ImmunitiesModule.IsImmune(KillerType : string, EffectName : string) : boolean?
   if not table.find(ImmunitiesModule[KillerType], EffectName) then return false end
   return true
end

With this approach you can easily scale up your game just by adding a few strings if you wanna add diverse immunities system

1 Like

it worked, i just made mistake with remote event last time

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.