Hi, this is my second question and I would quickly like to say this is a great website and I really appreciate everyone's support. So I have this script and what it does is when the ball touches a part on the goal line it is counted as a goal and the player and ball is teleported to the start which is does. What I want it to do is that once 3 goals are scored it teleports the player and ball to a different place, the script below just teleports the player and ball to the start where as I want to teleport it to a different position. I'm new to scripting so sorry if this is something very basic but I would really appreciate some help, thank you.
Goals = 0
ballname = "Ball"
function onTouch(hit)
if hit.Name == ballname then
wait(0.1)
game.Workspace.Ball.CFrame=CFrame.new(-276, 46.4, 163)
target = CFrame.new(-262.5, 44.5, 160)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
Goals = Goals + 1
if Goals == 3 then
Goals = true
if true then
wait(0.1)
game.Workspace.Ball.CFrame=CFrame.new(-300, 46.4, 163)
target = CFrame.new(-320, 44.5, 160)
for i, player in ipairs(game.Players:GetChildren()) do
if player.Character and player.Character:FindFirstChild("Torso") then
player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0)
end
end
end
end
end
script.Parent.Touched:connect(onTouch)

2 comments
Try using multiple if statements when you teleport the player. So that it checks if the player has 3 scores, if so: go here, otherwise go to start.
I honestly don't know what you mean by that, could you write some sample code please ?