Im doing a soccer score script, i added a event that gets fired when a team scores but it seams to not work, if you need extra info, leave a reply.
local players = game:GetService("Player")
local scoreBoardGui = workspace.Soccer.ScoreBoard
local scoreBoardGui2 = workspace.Soccer.ScoreBoard2
local RedScore = scoreBoardGui.GuiRed.TextBox
local BlueScore = scoreBoardGui.GuiBlue.TextBox
local RedScore2 = scoreBoardGui2.GuiRed.TextBox
local BlueScore2 = scoreBoardGui2.GuiBlue.TextBox
local goalRed = workspace.Soccer.GoalDetectorRed
local goalBlue = workspace.Soccer.GoalDetectorBlue
local ball = workspace.Soccer.Ball
local originalposition = workspace.Soccer.BallPosition
local function score(team)
team.Text = team.Text +1
if score(team) == BlueScore or BlueScore2 then
game.ReplicatedStorage.BlueScored:FireClient(players)
elseif score(team) == RedScore or RedScore2 then
game.ReplicatedStorage.RedScored:FireClient(players)
end
ball.Anchored = true
ball.Position = originalposition.Position
ball.AssemblyLinearVelocity = Vector3.new(0,0,0)
ball.AssemblyAngularVelocity = Vector3.new(0,0,0)
wait(1)
ball.Anchored = false
end
ball.Touched:Connect(function(part)
if part == goalRed then
score(BlueScore)
score(BlueScore2)
elseif part == goalBlue then
score(RedScore)
score(RedScore2)
end
end)