Here is the code:
script.Parent.Activation.OnServerEvent:Connect(function()
local part = Instance.new("Part")
part.Size = Vector3.new(1,1,1)
part.Transparency = 0
part.CanCollide = false
hitboxActivated = true
script.Parent.Handle.Touched:Connect(function(hit)
--NPC
if hit.Parent:FindFirstChild("Torso") and hitboxActivated == true then
local torsoPart = hit.Parent:FindFirstChild("Torso")
hitSFX.Parent = torsoPart
hitSFX.Volume = 2
screamSFX.Parent = torsoPart
hitSFX:Play()
screamSFX:Play()
torsoPart.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 1500
hitboxActivated = false
end
--PLAYER
if hit.Parent:FindFirstChild("Torso") and hitboxActivated == true then
local torsoPart = hit.Parent:FindFirstChild("HumanoidRootPart")
hitSFX.Parent = torsoPart
hitSFX.Volume = 2
screamSFX.Parent = torsoPart
hitSFX:Play()
screamSFX:Play()
part.Position = torsoPart.Position
part.AssemblyLinearVelocity = script.Parent.Handle.CFrame.LookVector * 100
part.Parent = torsoPart
local weld = Instance.new("WeldConstraint")
weld.Part0 = part
weld.Part1 = torsoPart
hitboxActivated = false
end
end)
wait(3)
hitboxActivated = false
end)
Whenever I test the tool in game, it doesn’t apply the force onto the hit player. It just does
AssemblyLinearVelocity = 0,0,-0
I have tried multiple ways to try and fix, but still no luck. Does anybody know how to fix this problem?