I made a skill, and I’m trying to add damage to it, I’m using a module script to deal the dmg, but when I call the module script function, it doesn’t deal dmg and the skill doesn’t tween, even if I use spawn()
Here’s the module script:
local skillsModule = {}
skillsModule.damagePlr = function(position, size, dmg, skillType, duration, x)
local pos1 = position - (size / 2)
local pos2 = position + (size / 2)
local region = Region3.new(pos1, pos2)
local partsInRegion = game.Workspace:FindPartsInRegion3(region)
if skillType == "Single" then
for i, v in pairs(partsInRegion) do
if v.Parent:FindFirstChild("Humanoid") then
v.Parent:FindFirstChild("Humanoid"):TakeDamage(dmg)
end
end
elseif skillType == "Multiple" then
while wait(duration) do
wait(x)
for i, v in pairs(partsInRegion) do
if v.Parent:FindFirstChild("Humanoid") then
print("Plr is in hitbox!")
v.Parent:FindFirstChild("Humanoid"):TakeDamage(dmg)
end
end
end
end
end
return skillsModule
Here’s the skill script (the part where I call the function):
spawn(skillsModule.damagePlr(hitbox.Position, hitbox.Size, 5, "Multiple", 5, 1))
Under the function call, it’s the tweening stuff, which doesn’t happen