game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(player, orignPosition, direction)
local params = RaycastParams.new() params.FilterDescendantsInstances = {player} params.FilterType = Enum.RaycastFilterType.Blacklist local result = workspace:Raycast(orignPosition, direction, params) print(result) if result then local character = result.Instance.Parent local humanoid = character:FindFirstChild("Humanoid") local VictimPlayer = game.Players:GetPlayerFromCharacter(character) local VictimDamage = VictimPlayer:WaitForChild("Damage") VictimDamage.Value = VictimDamage.Value + 5 if humanoid and humanoid ~= player.Character.Humanoid then local linearVelocity = Instance.new("LinearVelocity") local Attachment = Instance.new ("Attachment") linearVelocity.Name = "LinearVelocity" linearVelocity.MaxForce = 100000000000000000000000 linearVelocity.RelativeTo = Enum.ActuatorRelativeTo.Attachment0 linearVelocity.Attachment0 = character.HumanoidRootPart.RootRigAttachment linearVelocity.VectorVelocity = (player.Character.HumanoidRootPart.CFrame.lookVector) * VictimDamage.Value linearVelocity.Parent = character.HumanoidRootPart Attachment.Parent = character.HumanoidRootPart game:GetService("Debris"):AddItem (linearVelocity,0.05) print("success") print (VictimDamage.Value) print(linearVelocity.VectorVelocity) end end
end)