M1.OnServerEvent:Connect(function(player,walkspeed,mousetable)
local Camera = workspace.CurrentCamera
local head = player.Character.Head
local humanoid = player.Character.Humanoid
local Damage = player.PvPStats.Damage.Value
local blockedDamage = 0.80 * Damage
local HumanoidRootPart = humanoid.Parent:WaitForChild("HumanoidRootPart")
local hitbox = player.Character.HitBox
local ray = Camera:ViewportPointToRay(mousetable[1],mousetable[2])
local rayparams = RaycastParams.new()
rayparams.FilterDescendantsInstances = {player.Character}
rayparams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastresult = workspace:Raycast(head.Position,ray.Direction * 10,rayparams)
local commands = {
blocking = player.Character:WaitForChild("Blocking")
}
humanoid.WalkSpeed = 9
for i,v in pairs(commands) do
v.Disabled = true
end
if raycastresult then
print(raycastresult.Instance)
local part = Instance.new("Part")
part.Position = raycastresult.Position
part.Anchored = true
part.Size = Vector3.new(2,2,2)
part.Parent = workspace
wait(1)
part:Destroy()
end
wait(0.3)
humanoid.WalkSpeed = walkspeed
for i,v in pairs(commands) do
v.Disabled = false
end
end)
local function hit (player)
local walkspeed = player.Character.Humanoid.WalkSpeed
local mouseposition = UserInputService:GetMouseLocation()
local mousetable = {
mouseposition.X,
mouseposition.Y,
}
M1:FireServer(walkspeed,mousetable)
end
im making a combat script and i want to fire a ray at the players cursor how would i do that
(if i dont respond im prob at school)