Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can i make commands with the "wp" variable outside of the if loop ?

Asked by 3 years ago
Edited 3 years ago
while script.Disabled == false do
    local mapstoragechild = game.Workspace.MapStorage:GetChildren()
    local players = game.Players:GetPlayers()
    local message = game.Workspace.Message

    function tpbak()
        local lp = game.Workspace.MapStorage.Map.PlayerStorage:GetChildren()
        local wp = ()
        for i = 1, #lp do
            if lp[i].GameKills.Value >= 30 then
                wp = lp[i]          
            end
        end
        if lp then
            print(lp)
            local lpn = game.Players:GetPlayerFromCharacter(lp)
            if lpn then
                local humanoid = lp:FindFirstChild("Humanoid")
                if humanoid then
                    humanoid.Health = 0
                end

                local lpm = lpn.leaderstats.Money
                local lpw = lpn.leaderstats.Wins
                lpm.Value = lpm.Value + 10
                lpw.Value = lpw.Value + 1
            end
        end
        local playerss = game.Players:GetPlayers()
        for i = 1, #playerss do
            playerss[i].GameKills.Value = 0
            print("GK silme basarili :)")
        end
    end
    while #mapstoragechild == 1 do
        local allp = game.Workspace.MapStorage.Map.PlayerStorage:GetChildren()
        for i = 1 , allp do
            if allp[i].GameKills.Value >= 30 then
                tpbak()
                wait(1)
                game.Workspace.MapStorage:ClearAllChildren()
                script.Parent.Gameselect.Disabled = true
                wait(3)
                script.Parent.Intermission.Disabled = false
                message.Value = "Game Ended! Thanks for All Participants"
                game.Workspace.Gamemode.Value = 0
                game.Workspace.Songs.Songloop.Disabled = false
                wait(1)
                script.Parent.Gameselect.Disabled = false
                script.Disabled = true
            end
        end
        wait(0.1)
    end
end

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
local kills = 0 
Ad

Answer this question