So, I’m making a quick soccer game for me and my friends to play but for some reason when the ball touches one of the nets it should run the if statements but for some reason it’s not. (it does print that it is a touched by a net but it doesn’t run.)
script.Parent.Touched:Connect(function(hit)
print(hit.Name)
if hit and hit.Parent.Humanoid and debounce == false then
debounce = true
local humanoid = hit.Parent.Humanoid
local ball = script.Parent
print("touched")
ball.Velocity = hit.Parent.HumanoidRootPart.CFrame.LookVector * speed
--ball.Velocity.Y = Vector3.new(ball.Position.X, ball.Position.Y == ball.Position.Y *2, ball.Position.Z)
----ball.Velocity.Y = ball.Velocity.Y * 5
script.Kicking:Play()
wait(0.2)
debounce = false
end
if hit.Name == "Goal1" and scoredebounce == false then
scoredebounce = true
game.Workspace.Team1.Value += 1
script.Parent = game.ServerStorage
wait(5)
script.Parent.Position = oldposition
script.Parent = game.Workspace
scoredebounce = false
elseif hit.Name == "Goal2" and scoredebounce == false then
scoredebounce = true
game.Workspace.Team2.Value += 1
script.Parent = game.ServerStorage
wait(5)
script.Parent.Position = oldposition
script.Parent = game.Workspace
scoredebounce = false
end
end)