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

attempt to call upvalue (a table value) how do i fix this?

Asked by
3wdo 198
4 years ago

so im making a game based off a game show called the death pit where you answer questions and if you dont answer them correctly you will fall into a pit. im trying to make it so its picks a random platform then asks a random question. can someone help?

local random = math.random(1, 3)
local qtable = {}
qtable[1] = "How do you say Apple in spanish"
qtable[2] = "In the rubiks cube wca, What shape is the megaminx"
qtable[3] = "What's ikons most liked song"
game.ReplicatedStorage.starting.OnClientEvent:Connect(function(player)
    print("Client Fired")
    wait(10)
    if random == 1 then 
        script.Parent.Text = "Platform 1, "..qtable(math.random(1,3)).."?"
        script.Parent.Platform.Value = 1
        if random == 2 then
            script.Parent.Text = "Platform 2, "..qtable(math.random(1,3)).."?"
            script.Parent.Platform.Value = 2
            if random == 3 then
            script.Parent.Text = "Platform 3, "..qtable(math.random(1,3)).."?"
            script.Parent.Platform.Value = 3
            end
        end
    end
end)

1 answer

Log in to vote
1
Answered by 4 years ago

Change all the places you have:

qtable(math.random(1,3))

to:

qtable[math.random(1,3)]
Ad

Answer this question