Hello! I have an issue with my map script. I have an admin panel that allows me to start and end games. However, whenever i click the button to start a game with my alt in the server, 2 games start at once. How may i fix it
--This is in a server script inside the admin panel
local TS = game:GetService("TweenService")
local broadcast = game.StarterGui.ScreenGui.Frame
function broadcasts(minigame)
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {ImageTransparency = 0}):Play()
wait(0.3)
broadcast.ImageLabel.background.Text = minigame
broadcast.ImageLabel.background.main.Text = minigame
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {TextTransparency = 0}):Play()
wait(0.3)
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Rotation = -2}):Play()
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Position = UDim2.new(-0.07, 0,-0.157, 0)}):Play()
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Size = UDim2.new(0, 570,0, 92)}):Play()
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {Rotation = -2}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {Rotation = -2}):Play()
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {TextSize = 20}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {TextSize = 20}):Play()
wait(1)
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Rotation = 0}):Play()
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {Rotation = 0}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {Rotation = 0}):Play()
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Size = UDim2.new(0,555,0,74)}):Play()
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {TextSize = 14}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {TextSize = 14}):Play()
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {Position = UDim2.new(-0.039, 0,-0.157, 0)}):Play()
wait(0.5)
TS:Create(broadcast.ImageLabel, TweenInfo.new(0.2), {ImageTransparency = 1}):Play()
TS:Create(broadcast.ImageLabel.background, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
TS:Create(broadcast.ImageLabel.background.main, TweenInfo.new(0.2), {TextTransparency = 1}):Play()
end
script.Parent.MouseButton1Click:Connect(function()
local num = math.random(1,6)
if num == 1 then
local cloneSword = game.ReplicatedStorage.maps.Swordfight:Clone()
cloneSword.Parent = game.Workspace.minigame
broadcasts("Sword Fight")
elseif num == 2 then
local cloneObby = game.ReplicatedStorage.maps.obby:Clone()
cloneObby.Parent = game.Workspace.minigame
broadcasts("Obby")
elseif num == 3 then
local cloneMaze = game.ReplicatedStorage.maps.Maze:Clone()
cloneMaze.Parent = game.Workspace.minigame
broadcasts("Maze")
elseif num == 4 then
local clonepotato = game.ReplicatedStorage.maps.Tag:Clone()
clonepotato.Parent = game.Workspace.minigame
broadcasts("Tag, Your It")
elseif num == 5 then
local cloneFind = game.ReplicatedStorage.maps.Find:Clone()
cloneFind.Parent = game.Workspace.minigame
wait(0.2)
local FindIt = game.ReplicatedStorage.RepItems["You Found It!"]:Clone()
FindIt.Parent = game.Workspace
broadcasts("Find it")
local Extra = game.ReplicatedStorage.RepItems.ExtraPoint:Clone()
Extra.Parent = game.Workspace
elseif num == 6 then
local clone = game.ReplicatedStorage.maps.Dodgeball:Clone()
clone.Parent = game.Workspace.minigame
local dodgeballs = game.ReplicatedStorage.RepItems.Dodgeball:Clone()
dodgeballs.Parent = game.Workspace
broadcasts("Dodgeball")
end
end)