Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

My Intermission Script Doesnt Work. Pls Help. How i Solve it? ._. my title is spesific [closed]

Asked by 4 months ago
Edited 4 months ago
game.Players.PlayerAdded:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)

game.Players.PlayerRemoving:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)
--script no1 (enough players)
local sutart = 20
for i = sutart,0,-1 do
    wait(1)
    script.Parent.Text = i .. " Secconds Reaming"
end
--script no 2 (not enough players)
while true do
    script.Parent.Text = "Waiting Players."
    wait(1)
    script.Parent.Text = "Waiting Players.."
    wait(1)
    script.Parent.Text = "Waiting Players..."
    wait(1)
end

Closed as Non-Descriptive by evaera

This question has been closed because its title or content does not adequately describe the problem you are trying to solve.
Please ensure that your question pertains to your actual problem, rather than your attempted solution. That is, you were trying to solve problem X, and you thought solution Y would work, but instead of asking about X when you ran into trouble, you asked about Y.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 months ago

Edit it a bit

local PlayersAmount = game.ServerStorage:WaitForChild("Playernum").Value
local Players = game:GetService("Players")
local MinigameScript = -- Your Minigame Script
local MinigameScript2 = -- Your Minigame Script 2

local function PlayersFunction(Found)
   if Found == true then
      PlayersAmount = PlayersAmount + 1
   elseif Found == false then
   if PlayersAmount >= 1 then
      PlayersAmount = PlayersAmount - 1
      end
   end
end

local function ToggleMinigame()
   if PlayersAmount >= 2 then
      MinigameScript.Disabled = false
      MinigameScript2.Disabled = true
   else
      MinigameScript.Disabled = true
      MinigameScript2.Disabled = false
   end
end

Players.PlayerAdded:Connect(PlayersFunction(true))

Players.PlayerRemoving:Connect(PlayersFunction(false))

PlayersAmount:GetPropertyChangedSignal("Value"):Connect(ToggleMinigame)
Ad
Log in to vote
0
Answered by 4 months ago

Alright So You Made A Few Errors:

game.Players.PlayerAdded:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)

game.Players.PlayerRemoving:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)

It Should Be This:

game.Players.PlayerAdded:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScript.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScript.Disabled = false
    end
end)

game.Players.PlayerRemoving:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScript.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScript.Disabled = false
    end
end)

Next Time Maybe Have A Look In Output For Errors

0
um local scripte and local script is not same Omerevkizel 16 — 4mo
0
Did u try mine ? WoGiTeam 60 — 4mo
0
um if u try yours i disable and undisable in same time my localscript Omerevkizel 16 — 4mo