Everytime the ball hits the goal it should score and when it scores every other touch functions of the module script breaks
I don’t know why is it doing this
Code
local function TrueScore(hit, TeamName)
print("worked")
Scored.Value = true
TimeRunning.Value = false
hit.Equip.Disabled = true
SpeedPlayers(0)
Removal.Value = true
FireText("Team"..TeamBall.Value.." Scores")
TeamName.Value = TeamName.Value + 2
repeat wait() until Scored.Value == true
wait(2)
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team1Tp, 16)
elseif Team2Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team2Tp, 16)
end
end
Removal.Value = false
ShotClock.Value = 24
Scored.Value = false
TimeRunning.Value = true
if TeamBall.Value == 1 then
CloneBall(Team2Tp)
elseif TeamBall.Value == 2 then
CloneBall(Team1Tp)
else
CloneBall(BallTip)
end
FireText("")
end
local function FalseScoring(hit, Name)
print("worked")
TimeRunning.Value = false
hit.Equip.Disabled = true
SpeedPlayers(0)
Removal.Value = true
FireText("False Scoring On "..Name)
wait(2)
for _, Player in pairs(game.Players:GetPlayers()) do
if Team1Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team1Tp, 16)
elseif Team2Folder:FindFirstChild(Player.Name) then
TeleportPlayers(Player, Team2Tp, 16)
end
end
Removal.Value = false
ShotClock.Value = 24
TimeRunning.Value = true
if TeamBall.Value == 1 then
CloneBall(Team2Tp)
elseif TeamBall.Value == 2 then
CloneBall(Team1Tp)
else
CloneBall(BallTip)
end
FireText("")
end
for _, ShootingPart in pairs(ShootingParts) do
ShootingPart.Touched:Connect(function(hit)
local Ball = hit.Parent
if Ball:IsA("Tool") then
if ShootingPart.Name == "Team1Goal" then
if TeamBall.Value == 2 and Team2Score.Value < 22 then
if not ShootDebounce then
ShootDebounce = true
TrueScore(hit, Team1Score)
wait(1)
Debounce = false
end
elseif TeamBall.Value == 2 and Team2Score.Value == 22 - 2 then
if not ShootDebounce then
Debounce = true
GameFinished(TeamBall, Team2Score)
wait(1)
Debounce = false
end
elseif TeamBall.Value == 1 then
if not ShootDebounce then
Debounce = true
FalseScoring(hit, hit.Values.BallHandler.Value)
wait(2)
Debounce = false
end
end
elseif ShootingPart.Name == "Team2Goal" then
if TeamBall.Value == 1 and Team1Score.Value < 22 then
if not ShootDebounce then
ShootDebounce = true
TrueScore(hit, Team1Score)
wait(1)
Debounce = false
end
elseif TeamBall.Value == 1 and Team1Score.Value == 22 - 2 then
if not ShootDebounce then
Debounce = true
GameFinished(TeamBall, Team1Score)
wait(1)
Debounce = false
end
elseif TeamBall.Value == 2 then
if not ShootDebounce then
Debounce = true
FalseScoring(hit, hit.Values.BallHandler.Value)
wait(2)
Debounce = false
end
end
end
end
end)
end
Also the scoring does not work too