I want to make a “ball” to kick and I’ve made the raycast, issue is I don’t know how to make the ball itself move along the raycast. Maybe I shouldn’t use a raycast for this but it just seems so convenient.
So, how do I make the ball move along the raycast.
local conn
local debonce = false
local tool = script.Parent
local request = tool:WaitForChild("Request")
local send = tool:WaitForChild("Send")
script.Parent.Activated:Connect(function()
if debonce == true then
else
debonce = true
local char = script.Parent.Parent
local hitbox = char:WaitForChild("Hitbox")
conn = hitbox.Touched:Connect(function(hit)
conn:Disconnect()
if hit.Name == "Ball" then
print("balls")
request:FireClient(game.Players:GetPlayerFromCharacter(char))
send.OnServerEvent:Connect(function(pos)
local start = char["Right Leg"]
local goal = Vector3.new(pos)
local direction = (goal - start.Position).Unit
local result = workspace:Raycast(start.Position, direction * 100)
print(result)
print(pos)
print(pos)
hit.AssemblyLinearVelocity(result)
end)
end
end)
task.wait(2)
debonce = false
end
end)