Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ServerScriptService Script
- local Goal = game.ReplicatedStorage:WaitForChild("Goal")
- local Team1 = game.Workspace:WaitForChild("Team1")
- local Team2 = game.Workspace:WaitForChild("Team2")
- local Ball = game.Workspace:WaitForChild("Ball")
- local OriginalPosition = Ball.Position
- local Points = {0, 0}
- local function resetBall()
- Ball.CFrame = CFrame.new(OriginalPosition)
- end
- Team1.Touched:Connect(function(hit)
- if hit == Ball then
- Points[1] = Points[1] + 1
- Goal:FireAllClients(Points)
- resetBall()
- end
- end)
- Team2.Touched:Connect(function(hit)
- if hit == Ball then
- Points[2] = Points[2] + 1
- Goal:FireAllClients(Points)
- resetBall()
- end
- end)
- game.Players.PlayerAdded:Connect(function(player)
- Goal:FireClient(player, Points)
- end)
- -------------------------------------------------------------------------------------------------------------------------------------
- --Textlabel LocalScript
- local Goal = game.ReplicatedStorage:WaitForChild("Goal")
- local function SetPoints(points)
- script.Parent.Text = points[1].." - "..points[2]
- end
- Goal.OnClientEvent:Connect(function(points)
- SetPoints(points)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement