Hi, so I already got a soccer ball and a goal, and how do I want the ball to go back to the middle of the field after the ball was in the goal...Is anyone kind enough to help me? Thanks :p
COMMUNITY QUESTION
How Do I Make a Functional Soccer Ball Goal?
1 answer
Hello there.
Before you start, make sure to put the field in a model. Then add a script inside the model.
Now you put an invisible wall in the two goals, and it has to have CanCollide to false.
After that, you put this line of code into your script:
local Detector1 = script.Parent.Detector1 -- The 'red' team's invisible wall
local Detector2 = script.Parent.Detector2 -- The 'blue' team's invisible wall
local Ball = script.Parent.Ball
local Main = script.Parent.Main
Detector1.Touched:Connect(function(Toucher) -- Detects if there's a ball in 'red'
if Toucher.Name == 'Ball' then
Ball.Position = Main.Position
Ball.Anchored = true
wait(3)
Ball.Anchored = false
end
end)
Detector2.Touched:Connect(function(Toucher) -- Detects if there's a ball in 'blue'
if Toucher.Name == 'Ball' then
Ball.Position = Main.Position
Ball.Anchored = true
wait(3)
Ball.Anchored = false
end
end)
You're welcome, and have fun.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
local a = Instance.new("Part",workspace) boom, it will auto unanchor and make it collidable a.Position = Vector3.new(0,0,0)