local serverStorage = game:GetService("ServerStorage")
local replicatedStorage = game:GetService("ReplicatedStorage")
local modules = serverStorage:WaitForChild("Modules")
local mhb = require(modules:WaitForChild("HitBox"))
local remotes = replicatedStorage:WaitForChild("Remotes")
local events = remotes:WaitForChild("Events")
local eventsBat = events:WaitForChild("Bat")
local swingBat = eventsBat:WaitForChild("SwingBat")
swingBat.OnServerEvent:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
local bat = character:WaitForChild("bat")
local hbTarget = bat:WaitForChild("hitboxhere")
local hb = mhb(hbTarget)
spawn(function()
wait(1)
hb:Destroy()
end)
hb.Touched:Connect(function(hit)
hb:Destroy()
local character = hit.Parent
local characterHumanoid = character:WaitForChild("Humanoid")
local characterRoot = character:WaitForChild("HumanoidRootPart")
characterHumanoid:TakeDamage(10)
end)
end)
Yes, I know spawn is bad practice but coroutine.wrap won’t wont for me.
are you sure you’re part named "hitboxhere" is Archivable? If it isn’t, the problem is that it won’t show up in scripts, therefore meaning a infinite yield (because you did WaitForChild)