I am not the best scripter so I have come here for a bit of help… I have a baseball bat inside my game and I would like to lower the amount of damage is does to a player, I have looked through the script myself and are unable to find where it could be or how to do it, here is the script below
It appears so, but I must say this code isn’t the best formatted so it is hard to read. In the OnActivated Function it sets the damage variable to a value in the damages table.
It’s just declaring the variable, and in this case initializing it as well. It is better to declare variables if you will be using them globally. Writing damages[1] a bunch of times will get 1. repetitive, 2. hard to read.
What I was getting at is that, wouldn’t it be easier to understand the values of damage at a certain line of code if the code had 3 separate variables initialized for the respective damages instead of manually changing a single variable to represent the damage at different times.
For example,
--Initializing various damages
local Damage = 10
local slashDamage = 20
local lungeDamage = 30
instead of having the current code
local damage = 30
local damages = {10,20,30}
-- Change Damages at different points
damage = damages[1]
damage = damages[2]
damages = damages[3]
This would be one of suggestions for the current code to make it more readable.
But also to OP,
let me know if Kaworu’s solution fixed your current problem with your code. I’m sure we’ll both be more than glad to continue offering our assistance to you.