im trying to make something like blade balls parry but its kicking instead local ball = script.Parent
local Players = game:GetService(“Players”)
local UserInputService = game:GetService(“UserInputService”)
local ballHighlight = ball:FindFirstChild(“Highlight”)
if not ballHighlight then
print(“No Highlight”)
end
local lastHitter = nil
local chasingColor = Color3.fromRGB(255, 0, 4)
local normalColor = Color3.fromRGB(255, 255, 255)
function setHighlightColor(color)
if ballHighlight then
ballHighlight.FillColor = color
end
end
function getRandomPlayer()
local players = Players:GetPlayers()
local maxAttempts = 10
local attempts = 0
local candidate = nil
repeat
attempts = attempts + 1
candidate = players[math.random(1, #players)]
wait()
until attempts >= maxAttempts or (candidate ~= lastHitter and candidate.Character and candidate.Character:FindFirstChild("HumanoidRootPart"))
lastHitter = candidate
return candidate
end
local function moveBall()
local targetPlayer = getRandomPlayer()
local targetPosition = targetPlayer.Character and targetPlayer.Character:FindFirstChild(“HumanoidRootPart”)
if targetPosition then
local direction = (targetPosition.Position - ball.Position).unit
local speed = 50
ball.Velocity = direction * speed
setHighlightColor(chasingColor)
wait(1)
setHighlightColor(normalColor)
end
end
function onHit()
local mouse = Players.LocalPlayer:GetMouse()
local hitDirection = (ball.Position - mouse.Hit.p).unit
local hitForce = 1000
ball.Velocity = hitDirection * hitForce
local humanoid = Players.LocalPlayer.Character:FindFirstChild("Humanoid")
if humanoid then
local kickAnimation = humanoid:LoadAnimation(script.KickAnimation)
kickAnimation:Play()
end
end
ball.Touched:Connect(function(hit)
local character = hit.Parent
if character:IsA(“Model”) and character:FindFirstChild(“Humanoid”) then
moveBall()
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
local playerHighlight = humanoid.Parent:FindFirstChild("Highlight")
if playerHighlight then
playerHighlight.Enabled = true
end
wait(2)
if playerHighlight then
playerHighlight.Enabled = false
end
end
end
end)
UserInputService.InputBegan:Connect(function(input, processed)
if not processed then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
onHit()
end
end
end)
while true do
wait(5)
moveBall()
end
code so far can someone please tell me how to make the parry so far i cant figure it out