Here is my code:
local seconds = game.ReplicatedStorage.Seconds
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = Instance.new("RemoteEvent", ReplicatedStorage)
event.Name = "EndRound"
local Teams = game:GetService("Teams")
local Players = game:GetService("Players")
local function EndRoundNOW()
for i,v in pairs(Players:GetPlayers()) do
if v.Team == Teams["Playing"] then
pcall(function()
v.Character:BreakJoints()
end)
end
end
print("someone wants to end the round")
seconds.Value = 0
end
event.OnServerEvent:Connect(EndRoundNOW)
When no one is inside of the "Playing" team, the script breaks and doesn't work again once the GUI is clicked.
Here is the script that fires the event:
local debounce = false
local seconds = game.ReplicatedStorage.Seconds
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local event = ReplicatedStorage:WaitForChild("EndRound")
function leftClick()
if debounce == false then
if seconds.Value > 0 then
print("Left mouse clicked cool kid's end round button")
debounce = true
event:FireServer()
script.Parent.Text = "(15)"
wait(1)
script.Parent.Text = "(14)"
wait(1)
script.Parent.Text = "(13)"
wait(1)
script.Parent.Text = "(12)"
wait(1)
script.Parent.Text = "(11)"
wait(1)
script.Parent.Text = "(10)"
wait(1)
script.Parent.Text = "(9)"
wait(1)
script.Parent.Text = "(8)"
wait(1)
script.Parent.Text = "(7)"
wait(1)
script.Parent.Text = "(6)"
wait(1)
script.Parent.Text = "(5)"
wait(1)
script.Parent.Text = "(4)"
wait(1)
script.Parent.Text = "(3)"
wait(1)
script.Parent.Text = "(2)"
wait(1)
script.Parent.Text = "(1)"
wait(1)
script.Parent.Text = "End Round"
debounce = false
else script.Parent.Text = "bruh round is already over"
debounce = true
wait(1)
debounce = false
script.Parent.Text = "End Round"
end
end
end
script.Parent.MouseButton1Click:Connect(leftClick)

4 comments
Sorry, it didn't work. When I press the button, nothing happens.
There are also no errors in the output.
I believe this has something to do with the game, not the script. If you would like you can friend request me on roblox and maybe I can personally help you with the game?
Alr.