I am currently making a JoJo’s Bizarre Adventure Game on the ROBLOX Platform, as I’m finishing basic stand kit, I find myself a big if not giant problem, the barrage move for the Stand I’m making, after 1-hit, will always damage the player even if its not touching him, I tried multiple things to fix this glitch, but nothing worked, or it would deal 1 damage and stop, or deal the correct damage but the player would still get hurt even if the stand wasnt touching anything.
This is the part of the script that does the damage for the barrage move:
myStand["Right Arm"].Touched:connect(function(otherPart)
local StandBool = otherPart.Parent:FindFirstChild("StandBool")
if StandBool then
else
pchar = otherPart.Parent
hum = pchar:FindFirstChild("Humanoid")
if pchar then
local touch = myStand["Right Arm"]:GetTouchingParts()
for i,v in pairs(touch)do
if v then
for i = 1,40 do
if hum then
if punchCooldown == false then
hum:TakeDamage(1)
punchCooldown = true
local bodyVelocity = Instance.new("BodyVelocity") -- This is just for knockback.
bodyVelocity.Parent = pchar.HumanoidRootPart
bodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
bodyVelocity.Velocity = char.Torso.CFrame.lookVector*5
game.Debris:AddItem(bodyVelocity,0.1)
punchCooldown = true
wait(0.1)
punchCooldown = false
end
end
I’m sorry if this script is messy but, any ideas on how to fix it and what is causing this glitch?
Tl;dr : the barrage move for my game when hits a npc/player, will continue doing damage until the move ends, even if the user isnt touching the target, the moment it hits it will continue damaging the target even after the player’s stand isn’t touching any NPC or Player, only stopping when the move does.