Hello, I need to make the ball when touching the red square is thrown away, something like a “homeround” how can I do that?
script:
script.Parent.Touched:Connect(function(part)
if part.Name == "Handle" or part.Name == "Ball" then
print("Touched by the Handle or Ball")
local debris = game:GetService("Debris")
local ball = game.StarterPack.Ball.Handle
local bodyVelocity = Instance.new("BodyVelocity",ball) --create a body velocity and parent it to the ball
bodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge) -- Determines the limit on how much force that may be applied to each axis
bodyVelocity.P = 1000 -- Determines how aggressive of a force is applied in reaching the goal velocity
bodyVelocity.Velocity = ball.CFrame.lookVector * 100 + Vector3.new(0,50,0) -- make the goal of the velocity 100 studs out from where the ball is looking and up 50 studs.
debris:AddItem(bodyVelocity, 0.5) -- deletes the bodyVelocity after 0.5 seconds. You can adjust this value and the other values above to your liking
end
end)