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

Filtering Enabled Braking My Game?

Asked by 5 years ago
Edited 5 years ago

So i created my Minigames Game and When i turn on Filtering enabled no one of gui works same with scripts Here Main script Whats wrong? Can Someone Help?

math.randomseed(os.time())

Winners = {}

Settings = require(script.Settings)

Intermission = Settings.Intermission
GameTime = Settings.GameTime


function ChangeText(Text)
    local Players = game.Players:GetPlayers()
    for i = 1, #Players do
        Players[i].PlayerGui.Main.Time.Text = Text
    end
end

function GetMap()
    local Maps = game.ReplicatedStorage.Maps:GetChildren()
    local PickMap = math.random(1, #Maps)
    local SelectedMap = Maps[PickMap]:Clone()
    SelectedMap.Name = 'Map'
    SelectedMap.Parent = game.Workspace
end

function RemoveMap()
    if game.Workspace:FindFirstChild('Map') then
        game.Workspace.Map:remove()
    end
end

--// Game
while true do
    for i = Intermission, 0, -1 do
        ChangeText('Intermission ' ..i)
        wait(1)
    end

    local Players = game.Players:GetPlayers()
    for i = 1, #Players do
        Players[i].Playing.Value = true
    end

    ChangeText('Game starting...')
    wait(2)
    GetMap()
    wait(1)

    local Players = game.Players:GetPlayers()
    for i = 1, #Players do
        if Players[i].Playing.Value == true and Players[i].isAFK.Value == false then
            local Spawn = game.Workspace.Map.Spawns.Spawn
            Players[i].Character.Torso.CFrame = CFrame.new(Spawn.Position)

            local ClassicSword = game.ReplicatedStorage.ClassicSword
            ClassicSword:Clone().Parent = Players[i].Backpack

            --[[local AllPlayers = game.Players:GetPlayers()
            for i = 1, #AllPlayers do
                local PickPlayer = math.random(1, i)
                local SelectedPlayer = AllPlayers[PickPlayer]
                print(SelectedPlayer.Name)
                local ClassicSword = game.ReplicatedStorage.ClassicSword
                ClassicSword:Clone().Parent = game.Players:FindFirstChild(SelectedPlayer.Name).Backpack
            end]]

            Spawn:remove()
            Players[i].Character.Humanoid.WalkSpeed = 0
        end
    end

    for i = 5, 0, -1 do
        ChangeText('Starting in  ' ..i)
        wait(1)
    end 

    local Players = game.Players:GetPlayers()
    for i = 1, #Players do
        if Players[i].Playing.Value == true then
            Players[i].Character.Humanoid.WalkSpeed = 32
        end
    end

    ChangeText('BEGIN!')

    for i = GameTime, 0, -1 do
        ChangeText('GameTime ' ..i)
        wait(1)
    end


    local Players = game.Players:GetPlayers()
    for i = 2, #Players do
        if Players[i].Playing.Value == true then
            table.insert(Winners, Players[i].Name)
            Players[i].leaderstats.Cash.Value = Players[i].leaderstats.Cash.Value + 5
            Players[i].leaderstats.Gems.Value = Players[i].leaderstats.Gems.Value + 0
            Players[i].Character.Humanoid.Health = 0
            Players[i].Playing.Value = false

            Players[i].PlayerGui.Main.Award.TextLabel.Visible = true
        end
    end

    RemoveMap()
    ChangeText('GAME OVER!')
    wait(4) 

end

2 answers

Log in to vote
1
Answered by 5 years ago

Anything having to do with manipulating GUIS needs to be done in a local script and cannot be done in a regular script. You would use a remote event for the script to communicate with the local script

Ad
Log in to vote
0
Answered by
royee354 129
5 years ago
Edited 5 years ago

In filtering enabled, the startergui won't replicate to the playergui, therefor you will have to use local scripts, and you will have to parent your guis on your own to your playergui.

https://wiki.roblox.com/index.php?title=API:Class/Workspace/FilteringEnabled

Answer this question