Can you make a roblox shield system for a pvp game? Basically, when the player holds R,…
- User
Can you make a roblox shield system for a pvp game? Basically, when the player holds R, then they have a shield active.
To activate a shield, a remote event is fired called Shield and an animation is played for the client, and on the server an attachment inside the server script (script.ParticleHold.ShieldParticles) is cloned and placed into the player's Torso.
However, on the server, it simply uses a module (replicatedstorage.GameModules.Shield), and that contains the attachment clone and such.
So you'll need to make 3 scripts, client, server, and module.
Client: detects button presses and animations Server: fires module Module: clones attachments and stuff
On the module, it should contain a few functions, such as:
Shield(player) -- create a shield on this player DestroyShield(player) -- destroy the shield if this player has one active Disable(player) -- the player stopped holding R, disable the shield
Shield clones the particles and turns on character.ShieldActive, not turning it on if character.ShieldReady is false DestroyShield destroys the particles and attachment, turns off ShieldActive and ShieldReady if its true, waiting 6 seconds before the ShieldReady is turned back on, disabling ShieldReady if it's changed and it's true until the 5 seconds is up (to stop exploiters trying to force it back on) Disable, does the same as destroying the shield but for a 3 second wait
While the shield is on and active, the player can have it on for 3 seconds, every single tick the shield particles get more red (they use colorsequence so you'll need to use a special way to fade it to red) and as soon as the 3 second timer is up, if the shield is still active, then the shield is destroyed and the player takes 5% damage of their max health.
The particle attachment also has a PointLight which should follow the color.
If the shield is destroyed or disabled, turn off the particles, tween the light brightness across 1.5 seconds, and wait 1.5 seconds, then destroy the attachment.
If the shield is destroyed, fire a remote event back to the client to play an animation and to stop the hold animation Hold animation: script.Hold Break animation : script.Break
There are multiple particles and a PointLight inside of the ShieldParticles attachment
The player cannot jump nor walk while the shield is active, do this by using walkspeed and jumppower, however in the server script give the module the players walkspeed and jumppower and thats what the walkspeed and jumppower should return to when the player stops using the shield.
Can you do this?
- Assistant