It still works but I want to remove the error (“Humanoid is not a valid member of Workspace “Workspace””)
Remote.OnServerEvent:Connect(function(e,Direction,Origin)
Sound:Play()
local Damage = math.random(10,30)
local Head = math.random(1,2)
local Damage2 = math.random(88,100)
local Paramas = RaycastParams.new()
Paramas.FilterType = Enum.RaycastFilterType.Blacklist
Paramas.FilterDescendantsInstances = {e.Character}
local Hit = workspace:Raycast(Origin,Direction,Paramas)
if Hit.Instance then
print(Hit.Instance.Name)
if Hit and Hit.Instance and Hit.Instance.Name == "Head" and Head == 1 then
Hit.Instance.Parent.Humanoid.Health = Hit.Instance.Parent.Humanoid.Health-100
local Clone = Hit.Instance.Parent.Head:Clone()
Clone.Parent = Hit.Instance.Parent
Clone.Anchored = false
Clone.Name = "LimbHead"
for _,v in pairs(Hit.Instance.Parent.LimbHead:GetDescendants()) do
if v.ClassName == "Motor6D" then
v:Destroy()
end
end
local BodyV = Instance.new("BodyVelocity",Hit.Instance.Parent.LimbHead)
BodyV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
BodyV.Velocity = e.Character.HumanoidRootPart.CFrame.LookVector*23+Vector3.new(0,5,0)
game.Debris:AddItem(BodyV,.1)
Hit.Instance:Destroy()
elseif Hit and Hit.Instance and Hit.Instance.Name == "Head" and Head == 2 then
Hit.Instance.Parent.Humanoid.Health = Hit.Instance.Parent.Humanoid.Health-Damage2
elseif Hit and Hit.Instance and Hit.Instance.Name ~= "Head" and Hit.Instance.Parent.Humanoid then
Hit.Instance.Parent.Humanoid.Health = Hit.Instance.Parent.Humanoid.Health-Damage
end
end
end)