Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

Change all the places you have:

qtable(math.random(1,3))

to:

qtable[math.random(1,3)]

This discussion is preserved as it was. New answers, comments, and votes are closed.