Hey Devs! I got a proplem With my script and idk why does it do that Thats the code:
local script
local debounce = false
local debounce2 = false
local plr = game.Players.LocalPlayer
script.Parent.Cancel.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
wait(1)
script.Parent.Visible = false
script.Parent.Parent.Shower.Visible = true
script.Parent.Parent.Text.Visible = true
script.Parent.Parent.Chapters.Visible = true
script.Parent.PowerSwitchHouse.Value = false
script.Parent.PowerSwitchVillage.Value = false
script.Parent.PowerSwitchRoom.Value = true
script.Parent.TimeAndErrors.Text = "3 Players are the max, We are not planning to add more!"
script.Parent.CopiedStats:ClearAllChildren()
script.Parent.PlayersShower.Names.Value = 1
Instance.new("UIListLayout", script.Parent.CopiedStats)
debounce2 = false
end
end)
script.Parent.GoToLobby.MouseButton1Click:Connect(function()
print("ok")
end)
script.Parent.Ready.MouseButton1Click:Connect(function()
local PowerSwitchCountry = script.Parent.PowerSwitchCountry
PowerSwitchCountry.Value = true
local PowerSwitchFarm = script.Parent.PowerSwitchFarm
if PowerSwitchCountry.Value == true and debounce2 == false then
PowerSwitchFarm.Value = true
game.ReplicatedStorage.Returns:FireServer()
end
if PowerSwitchCountry.Value == true and debounce2 == true and script.Parent.PowerSwitchFarm.Value == false then
debounce2 = false
game.ReplicatedStorage.Returns:FireServer()
end
end)
game.ReplicatedStorage.Returns.OnClientEvent:Connect(function(player)
for i,v in ipairs(game:GetService("Players"):GetPlayers()) do
if debounce2 == false then
debounce2 = true
local function PlayerStats()
wait()
local CopiedStats = v.PlayerGui.Intermession.PartyIntermession.CopiedStats
wait()
local PlayerStats = v.PlayerGui.Intermession.PartyIntermession.PlayersShower
local Names = PlayerStats.Names
local CopiedPlayerStats = PlayerStats:Clone()
CopiedPlayerStats.Name = "PlayerStats "..Names.Value
CopiedPlayerStats.Parent = CopiedStats
CopiedPlayerStats["#"].Text = Names.Value
Names.Value = Names.Value + 1
CopiedPlayerStats.NameOfPlr.Text = player.Name
CopiedPlayerStats.Rank.Text = player:GetRoleInGroup(15193458).." : #"..player:GetRankInGroup(15193458)
end
local PowerSwitchHouse = script.Parent.PowerSwitchHouse
local PowerSwitchVillage = script.Parent.PowerSwitchVillage
local function num1()
if PowerSwitchHouse.Value == false then
PowerSwitchHouse.Value = true
script.Parent.TimeAndErrors.Text = "Waiting..."
wait(10)
if PowerSwitchHouse.Value == false then
return
else
script.Parent.TimeAndErrors.Text = "There is no other players to play with, Why don't you play solo?"
end
end
end
local function num2()
if PowerSwitchHouse.Value == true then
PowerSwitchHouse.Value = false
script.Parent.TimeAndErrors.Text = "Waiting..."
wait(10)
if PowerSwitchVillage.Value == true then
return
elseif PowerSwitchHouse.Value == false then
script.Parent.TimeAndErrors.Text = "Teleporting...With 2 Players"
wait(1)
game:GetService("TeleportService"):Teleport(10066707724, player)
end
end
end
local function num3()
if PowerSwitchVillage.Value == false then
PowerSwitchVillage.Value = true
script.Parent.ReadyPeople.Text = "Max"
script.Parent.TimeAndErrors.Text = "Waiting..."
wait(10)
script.Parent.TimeAndErrors.Text = "Teleporting...With 3 Players"
wait(1)
game:GetService("TeleportService"):Teleport(10066707724, player)
end
end
local function adding()
if script.Parent.PowerSwitchRoom.Value == true then
script.Parent.ReadyPeople.Text = script.Parent.ReadyPeople.Text + tostring(1)
if script.Parent.ReadyPeople.Text == "3" then
script.Parent.PowerSwitchRoom.Value = false
end
end
end
local number = string.lower(tonumber(0))
if number == "0" then
adding()
if script.Parent.ReadyPeople.Text == tostring(1) then
PlayerStats()
num1()
elseif script.Parent.ReadyPeople.Text == tostring(2) then
PlayerStats()
num2()
elseif script.Parent.ReadyPeople.Text == tostring(3) then
PlayerStats()
num3()
end
end
end
wait(3)
debounce = false
end
end)
The Other: Regular Script
game.ReplicatedStorage.Returns.OnServerEvent:Connect(function(plr)
game.ReplicatedStorage.Returns:FireAllClients(plr)
end)
The Video:
Help is appreciated