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

Why doesn't this work w/ FE ?

Asked by 9 years ago

I have a script, the main game script for a trvia game I'm making, and my only issues with it are:

It doesn't work with FilteringEnabled, no matter how hard I try to make it compatible. It usually keeps the same chosen contestant if I run it with FilteringEnabled off, so this could lead to unfairity.

--Core requirements
local Event = game.ReplicatedStorage.GameEvent
local Questions = game.ServerStorage.Questions
local Status = game.ServerStorage.Status
local Screen = game.Workspace.Screen
local Stage = game.Workspace.Stage
local StageTele = Stage.StageTele

local NormLight = game.Workspace.Light.NormLight
local GreenLight = game.Workspace.Light.GreenLight
local RedLight = game.Workspace.Light.RedLight

local RoundTime = 30

local datastore = game:GetService("DataStoreService"):GetDataStore("Wins")

playerdata = {}

Spawns = game.Workspace.Spawns:GetChildren()

--Table of EnabledTopics.
local Topics = {
    Questions["Language Arts"],
    Questions.Math,
    Questions.History,
    Questions.Science,
    Questions["Nerdy Shows"],
    Questions["Nerdy Games"]
}

--Table of DisabledTopics.
local DisabledTopics = {

}

--Main Game Loop
while true do
wait(5)

while true do
    wait(1)
    Contestants = game.Players:GetPlayers()

    if #Contestants > 0 then
    Guesser = Contestants[math.random(1, #Contestants)]

end
if Guesser then
    local GuesserChar = Guesser.Character
    if GuesserChar then
        local GuesserHuman = GuesserChar:FindFirstChild("Humanoid")
        if GuesserHuman and GuesserHuman.Health > 0 then
            Status.Value = 1

            CurrentTopic =  Topics[math.random(1, #Topics)]         

            PossibleQuestions = CurrentTopic:GetChildren()

            wait(5)
            Status.Value = 4
            CurrQuestion = PossibleQuestions[math.random(1, #PossibleQuestions)]
            GuesserChar.Torso.CFrame = CFrame.new(StageTele.Position + Vector3.new(0, 3, 0))

            Screen.Screen.SurfaceGui.TextLabel.Text =  CurrQuestion.Value

            Event:FireClient(Guesser, "A1", CurrQuestion.One.Value, CurrQuestion.One.Correct.Value)
            Event:FireClient(Guesser, "A2", CurrQuestion.Two.Value, CurrQuestion.Two.Correct.Value)
            Event:FireClient(Guesser, "A3", CurrQuestion.Three.Value, CurrQuestion.Three.Correct.Value)
            Event:FireClient(Guesser, "A4", CurrQuestion.Four.Value, CurrQuestion.Four.Correct.Value)

            local localtimer = RoundTime
            while localtimer > 0 do
            wait(1)
            localtimer = localtimer - 1
            Screen.Screen.SurfaceGui.Time.Text = "Time Left in this Round: "..localtimer

            SpawnTele = Spawns[math.random(1, #Spawns)]

            Event.OnServerEvent:connect(function(player, ...)
                if player == Guesser then
                    local tuple = {...}
                    if tuple[1] == "Win" then
                        Status.Value = 3
                        localtimer = -1
                        Event:FireClient(Guesser, "Begone")
                        NormLight.Enabled = false
                        GreenLight.Enabled = true
                        RedLight.Enabled = false
                        wait(3)
                        GuesserChar.Torso.CFrame = CFrame.new(SpawnTele.Position + Vector3.new(0, 3, 0))
                    elseif tuple[1] == "Lose" then
                        Status.Value = 2
                        localtimer = -3
                        NormLight.Enabled = false
                        GreenLight.Enabled = false
                        RedLight.Enabled = true
                        Event:FireClient(Guesser, "Begone")
                        wait(3)
                        GuesserChar.Torso.CFrame = CFrame.new(SpawnTele.Position + Vector3.new(0, 3, 0))
                    end
                end
            end)
            if localtimer == 0 then
                Status.Value = 2
                localtimer = -1
                NormLight.Enabled = false
                GreenLight.Enabled = false
                RedLight.Enabled = true
                Event:FireClient(Guesser, "Begone")
                wait(3)
                GuesserChar.Torso.CFrame = CFrame.new(SpawnTele.Position + Vector3.new(0, 3, 0))
            end

            end         

            wait(3)
            --Intermission
            Status.Value = 0
            NormLight.Enabled = true
            GreenLight.Enabled = false
            RedLight.Enabled = false
            wait(10)
        end
    end
end
end

end

I am really confused as to why it won't work.

0
I wonder why people never answer long questions like these...... XD. Sorry to get your hopes up on an answer raystriker6707 30 — 9y

Answer this question