#what would be the best optimized way to make a stun system?

1 messages · Page 1 of 1 (latest)

zinc cipher
#

i thought about making like an instance that tells me if someone is stunned or not and have a loop in the server that checks if players has this stunned instance but i think its going to be laggy, doing it on the local script would probably make a vulnerability so what would be the best way to make a stun system that isnt laggy and isnt vulnerable to exploits?

queen rose
#

I would give every player character a "Stun" attribute boolean, set it up on all players and playerjoined characterjoined, etc. Put it under the character since stun logic is tied to the character and it will reset to default on death.

Handle your stun logic on the server, and change states based on the attribute.

PlrCharacter:GetAttributeChangedSignal('Stun'):Connect(function()
    local isStunned = PlrCharacter:GetAttribute('Stun')
    if isStunned then
        --Stun effect.
    else
        --Remove stun effect.
    end
end)
faint scroll