I have checked, and rechecked, the chunk of code multiple times, but, it is not damaging a Player's Humanoid
, and I can not figure out why, because, there is no errors coming up in the Output, and, the printing shows that the first print is incorrect, but, the other is printing the correct number. The problem with the code is that, it is not damaging the Player's Humanoid with the selected Damage number, instead, it is dealing 12%
of Damage to a Player's Humanoid
, no matter what Number you choose for some reason. Here is the chunk on code I am currently using;
if msg:lower():sub(1,6+#Prefix+#Seperator) == Prefix.."damage"..Seperator then --The 'if' statement right here is checking to see if the Characters been 1-6, plus the number of Characters in Prefix and Seperator, if it is equal to the commands, e.x; ':'damage' 'TheAlpha local chk = msg:lower():sub(7+#Prefix+#Seperator):find(" ") --This gets the position of where the space ' ' is local plrz = GetPlr(plr,msg:sub(7+#Prefix+#Seperator)) --The 'GetPlr' function will get the Player's with the matching String in their names local num = 10; --If the 'chk' did not find a ' ', then it will return this number if chk then --This will check to see if ' ' is in the string, however, and if it is, it'll run the next chunk chk = chk +6+#Prefix+#Seperator --Increases the number size of the 'sub' from the position, e.x; :damage TheAlpha '15' --Will get the position here plrz = GetPlr(plr,msg:sub(7+#Prefix+#Seperator,chk-1)) --Rewrites the Variable 'plrz' to support the 'chk' num = chk+1 --Variable 'num' is now specifying 'chk', plus 1 for the sub end print(num,msg:sub(chk+1)) --Output: 12, 50 or 15 or 5 for i,v in pairs(plrz) do --Once 'plrz' is done getting the Player's with the matching String in their names, because the 'GetPlr' function returns a table afterwards, will call the generic 'for' loop, which will loop through that table coroutine.wrap(function() --The 'coroutine' here is to prevent pausing from the second generic 'for' loop, because, whenever I use 'spawn', it doesn't work like I wan't it to if v and v.Character then --This will check to see if the Player is still existant, and will check to see if the Player's Character exists for i2,v2 in pairs(v.Character:GetChildren()) do --This is the second generic 'for' loop, this one will loop through the Children of the currently Player's Character if v2:IsA("Humanoid") then --This will check to see if the current Child is a 'Humanoid', and if so, it will run the next chunk v2.Health = v2.Health - chk+1 --Yes, I have tried 'TakeDamage' as well ;-; end end end end)() end end