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?
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