I've had goal-line technology for nearly a year now... The script also teleports the ball back to the center circle. Here you go!
Put in a normal script in Workspace
team1=game.Teams["team1"]
team2=game.Teams["team2"]
score=1
model=game.Workspace.Ball
backup=model:clone()
function regen(a)
model:remove()
new_model=backup:clone()
new_model.Parent=game.Workspace
new_model:MakeJoints()
model=game.Workspace.Ball
end
function onG1(part)
if part.Name=="Ball" then
game.Workspace.Team2Score.Value=(game.Workspace.Team2Score.Value+score)
regen(a)
end
end
function onG2(part)
if part.Name=="Ball" then
game.Workspace.Team1Score.Value=(game.Workspace.Team1Score.Value+score)
regen(a)
end
end
game.Workspace.Goal1.Touched:connect(onG1)
game.Workspace.Goal2.Touched:connect(onG2)
Put in a normal script in the score GUI
team1=game.Teams["team1"]
team2=game.Teams["team2"]
type="-"
while true do
wait(0.1)
script.Parent.Label1.Text=team1.Name.." "..type.." "..game.Workspace.Team1Score.Value
script.Parent.Label2.Text=team2.Name.." "..type.." "..game.Workspace.Team2Score.Value
end
The Scoreboard (You'll see what I mean) needs to be in a Frame (You can re-size if how you want) and inside this frame, 2 text boxes. They are named Label1 & Label2. In Label1, change the text to "Team1 Score" and in Label2, change it to "Team1 Score" (WITHOUT THE QUOTATION MARKS!)
Make sure the script and 2 text boxes are in the same directory in that frame.
I also have 2 scripts in the ball that I forgot (As it's been about a year) if they are linked to this or not, so add them anyways!
Inside the ball, in a script named Hit
function onTouched(hit)
local torso = hit.Parent:findFirstChild("Torso")
if torso~=nil then
game.Workspace.GKWait1.CanCollide = false
game.Workspace.GKWait1a.CanCollide = false
game.Workspace.GKWait1b.CanCollide = false
game.Workspace.GKWait1c.CanCollide = false
wait(1)
script.Parent.PFix.Disabled = false
wait(2)
script.Disabled = true
end
end
script.Parent.Touched:connect(onTouched)
The other is named Touch
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit.Parent)
if X.TeamColor==BrickColor.new("Bright green")then
game.Workspace.Hit.Value = BrickColor.new("Bright green")
end end end
script.Parent.Touched:connect(onTouched)
function onTouched(hit1)
if hit1.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit1.Parent)
if X.TeamColor==BrickColor.new("Bright blue")then
game.Workspace.Hit.Value = BrickColor.new("Bright blue")
end end end
script.Parent.Touched:connect(onTouched)
function onTouched(hit2)
if hit2.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit2.Parent)
if X.TeamColor==BrickColor.new("Camo")then
game.Workspace.Hit.Value = BrickColor.new("Camo")
end end end
script.Parent.Touched:connect(onTouched)
function onTouched(hit3)
if hit3.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit3.Parent)
if X.TeamColor==BrickColor.new("Really blue")then
game.Workspace.Hit.Value = BrickColor.new("Really blue")
end end end
script.Parent.Touched:connect(onTouched)
function onTouched(hit4)
if hit4.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit4.Parent)
if X.TeamColor==BrickColor.new("Bright green") or X.TeamColor==BrickColor.new("Camo") then
game.Workspace.Scorer1.Value = X.Name
end end end
script.Parent.Touched:connect(onTouched)
function onTouched(hit5)
if hit5.Parent:FindFirstChild("Humanoid")~=nil then
X = game.Players:playerFromCharacter(hit5.Parent)
if X.TeamColor==BrickColor.new("Bright blue") or X.TeamColor==BrickColor.new("Really blue") then
game.Workspace.Scorer2.Value = X.Name
end end end
script.Parent.Touched:connect(onTouched)
I'm pretty sure that's all you need. Feel free to use it or any other ideas you got!
1 comment
Capitalize the .Name