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

Why won't this event fire?

Asked by 9 years ago

So, for my game, I have an event that fires in the main script that looks like this

event:FireAllClients("Class", "Explanation")

This should fire a tuple thingy in my localscript in ScreenGui that looks like this:

event.OnClientEvent:connect(function(...)
    local tuple = (...)
    if tuple[1] == "Results" then
        if tuple[2] == "Winner" then
            resultname.Text = "We have a winner!"
            resultname.TextColor3 = Color3.new(1, 0, 1)
            winner.Text = WinnerTag.Value .. " won the Blitz!"
        elseif tuple[2] == "No Winner" then
            resultname.Text = "Nobody Won!"
            resultname.TextColor3 = Color3.new(0, 170/255, 127/255)
            winner.Text = "Everyone was bloxxed in the Blitz! Better luck next time!"
        end
        results.Visible = true
        results.Position = UDim2.new(-.4, 0, 1, 0)
        results:TweenPosition(UDim2.new(.3, 0, .2, 0), "Out", "Quad", .5)
        wait(5)
        results:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", .5)
    elseif tuple[1] == "Class" then
        if tuple[2] == "Explanation" then
        explain.Visible = true
        explain.Position = UDim2.new(-.4, 0, 1, 0)
        explain:TweenPosition(UDim2.new(.3, 0, .2, 0), "Out", "Quad", .5)
        wait(5)
        explain:TweenPosition(UDim2.new(1, 0, 1, 0), "Out", "Quad", .5)
        end
    end
end)

The darn thing doesn't fire. Help! One more problem. So I have a bunch of stringvalues in ServerStorage. The mainscript changes the Status and Timer stringvalues to match a a gui should be displaying.

statustag.Value = "Blitz"
    timertag.Value = roundtimer -- this is a variable that has the amount of time for a blitz

and the code in my LocalScript looks like this...

function secondstomins(seconds)
    local minutes = math.floor(seconds / 60)
    local remainingseconds = seconds % 60
    if remainingseconds <= 0 then
        remainingseconds = "00"
    elseif remainingseconds <=9 then
        remainingseconds = "0" .. remainingseconds
    end
    return tostring(minutes) .. ":" .. remainingseconds
end

function update()
    if timertag.Value < 0 then
        statustitle.Text = statustag.Value 
    else 
        statustitle.Text = statustag.Value .. secondstomins(timertag.Value) 
    end
    if statustag.Value == "Intermission" then
            statustitle.TextColor3 = Color3.new(170/255, 0, 1)
    elseif statustag.Value == "Blitz" then
        statustitle.TextColor3 = Color3.new(1, 1, 0)
    elseif statustag.Value == "Loading Map" or statustag.Value == "Waiting for Players" then
        statustitle.TextColor3 = Color3.new(170/255, 0, 0)
    end

end

timertag.Changed:connect(function()
    local value = timertag.Value
    update()
end)

statustag.Changed:connect(function()
    local value = timertag.Value
    update()
end)

This doesn't work either! Please help me, it would be greatly appreciated! -Antharaziia

Answer this question