so i have a slice of code here and it used to work but then i edited it and now it doesnt and i am very sad.
local module = {}
--Services
local RS = game:GetService("ReplicatedStorage")
local SS = game:GetService("ServerStorage")
local StarterPlayer = game:GetService("StarterPlayer")
local SoundService = game:GetService("SoundService")
local Debris = game:GetService("Debris")
--Folders
local Events = RS.Events
local WeaponsSounds = SoundService.SFX.Weapons
local RSModules = RS.Modules
local SSModules = SS.Modules
--Events
local CombatEvent = Events.Combat
local VFXEvent = Events.VFX
--Modules
local SoundsModule = require(RSModules.Combat.SoundsModule)
local ServerCombatModule = require(SSModules.CombatModule)
local WeaponStatsModules = require(SSModules.Weapons.WeaponStats)
local HelpfulModule = require(SSModules.Other.Helpful)
local StunHandler = require(SSModules.Other.StunHandlerV2)
function module.BodyVelocity(parent, hrp, knockback, stayTime)
local bv = Instance.new("BodyVelocity")
bv.MaxForce = Vector3.new(math.huge, 0, math.huge)
bv.P = 50000
bv.Velocity = hrp.CFrame.LookVector * knockback
bv.Parent = parent
Debris:AddItem(bv, stayTime)
end
function module.NormalHitboxHit(char, eHum, currentWeapon, Hitbox, hit, hitAnim, swingVFX)
local eChar = eHum.Parent
local eHRP = eChar.HumanoidRootPart
local WeaponStats = WeaponStatsModules.getStats(currentWeapon)
local damage = WeaponStats.Damage
local knockback = WeaponStats.Knockback
local ragdollTime = WeaponStats.RagdollTime
local stunTime = WeaponStats.StunTime
if HelpfulModule.CheckForStatus(eChar, char, damage, hit.CFrame, true, true) then return end
eHum:TakeDamage(damage)
ServerCombatModule.stopAnims(eHum)
VFXEvent:FireAllClients("CombatEffects", RS.Effects.Combat[swingVFX], hit.CFrame, 3)
VFXEvent:FireAllClients("Highlight", eChar, .5, Color3.fromRGB(255, 255, 255), Color3.fromRGB(255, 255, 255))
SoundsModule.PlaySound(WeaponsSounds[weapon].Combat[swingVFX], eChar.Torso)
eHum.Animator:LoadAnimation(hitAnim):Play()
module.BodyVelocity(char.HumanoidRootPart, char.HumanoidRootPart, knockback, 0.25)
if char:GetAttribute("Combo") == 4 then
knockback = knockback * 5
HelpfulModule.Ragdoll(eChar, ragdollTime)
end
module.BodyVelocity(eHRP, char.HumanoidRootPart, knockback*1.1, 0.5)
StunHandler.Stun(eHum, stunTime)
task.wait(0.2)
ServerCombatModule.stopAnims(eHum)
end
return module
That is the code.
This is the line of code in question that errors:
SoundsModule.PlaySound(WeaponsSounds[weapon].Combat[swingVFX], eChar.Torso)
and this is the playsound function in a separate module script
local module = {}
local Debris = game:GetService("Debris")
function module.PlaySound(Sound, Parent)
local sound = Sound:Clone()
sound.Parent = Parent
sound:Play()
Debris:addItem(sound, 2)
end
return module