Can I have some feedback on this module?
local BattleEssentials = {}
local Settings = {
--Some quick Variables
ModuleVersion = "1.0", --Defining the module's version. (Required for the "ModuleInformation" function)
DefaultWalkSpeed = 16,
DefaultJumpPower = 50,
StunnedWalkSpeed = 6,
StunnedJumpPower = 24,
--This is making sure that the user didn't decide to delete the attributes.
--The module will run an error when is attempted to be used without attributes.
IsBurnEnabled = script:GetAttribute("IsBurnEnabled"),
IsFreezeEnabled = script:GetAttribute("IsFreezeEnabled"),
IsForceFieldEnabled = script:GetAttribute("IsForcefieldEnabled"),
IsStunEnabled = script:GetAttribute("IsStunEnabled"),
IsHealEnabled = script:GetAttribute("IsHealEnabled")
}
-- Functions (This is where all the magic happens!)
function BattleEssentials.ModuleInformation()
local String = "BattleEssentials Module Version ".. Settings.ModuleVersion .." \n Made by DullXxxswagfoxyxxX"
print(String)
end
function BattleEssentials.Freeze(PlayerCharacter, Duration)
if Settings.IsFreezeEnabled == true then
print("Function Authorised")
local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
local Particle = script.Particles.FreezeParticle:Clone()
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0
Particle.Parent = PlayerCharacter.Torso
wait(Duration)
Particle:Destroy()
Humanoid.WalkSpeed = Settings.DefaultWalkSpeed
Humanoid.JumpPower = Settings.DefaultJumpPower
else
error("Function was blocked by developer, if this is not meant to happen please check your module attributes")
end
end
function BattleEssentials.Stun(PlayerCharacter, Duration)
if Settings.IsStunEnabled == true then
print("Function Authorised")
local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
local Particle = script.Particles.StunParticle:Clone()
Particle.Parent = PlayerCharacter.Torso
Humanoid.WalkSpeed = Settings.StunnedWalkSpeed
Humanoid.JumpPower = Settings.StunnedJumpPower
wait(Duration)
Particle:Destroy()
Humanoid.WalkSpeed = Settings.DefaultWalkSpeed
Humanoid.JumpPower = Settings.DefaultJumpPower
else
error("Function was blocked by developer, if this is not meant to happen please check your module attributes")
end
end
function BattleEssentials.Burn(PlayerCharacter, Duration, Damage)
if Settings.IsBurnEnabled == true then
print("Function Authorised")
local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
local Particle = script.Particles.FireParticle:Clone()
local FireDuration = Instance.new("IntValue")
FireDuration.Name = "FireDuration"
FireDuration.Value = Duration
FireDuration.Parent = PlayerCharacter
Particle.Parent = PlayerCharacter.Torso
while FireDuration.Value > 0 do
wait(1)
Humanoid:TakeDamage(Damage)
FireDuration.Value = FireDuration.Value - 1
end
Particle:Destroy()
else
error("Function was blocked by developer, if this is not meant to happen please check your module attributes")
end
end
function BattleEssentials.Heal(PlayerCharacter, Ammount)
if Settings.IsHealEnabled == true then
print("Function Authorised")
local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
local Particle = script.Particles.HealParticle:Clone()
Humanoid.Health = Humanoid.Health + Ammount
else
error("Function was blocked by developer, if this is not meant to happen please check your module attributes")
end
end
function BattleEssentials.MaxHeal(PlayerCharacter)
if Settings.IsHealEnabled == true then
print("Function Authorised")
local Humanoid = PlayerCharacter:FindFirstChild("Humanoid")
local Particle = script.Particles.HealParticle:Clone()
repeat wait() Humanoid.Health = Humanoid.Health + 1 until Humanoid.Health == Humanoid.MaxHealth
else
error("Function was blocked by developer, if this is not meant to happen please check your module attributes")
end
end
return BattleEssentials
The function names pretty much explain what they do.