I’m trying to assign a table called Letters that updates every Round. The function assigns a new Hotkey for every round, increasing by 1 every Round. I’m using this as a minigame for my game.
Here’s how it works:
Game auto-generates WASD keys randomly and sends them to a localscript. The table’s name is Letters and each letter is assigned through a for loop. Heres the scripts:
-
– Server sided script
-
local Letters = {}
-
for count = 1, Round do
-
local randomLetter = script.Hotkeys:GetChildren()[math.random(1, #script.Hotkeys:GetChildren())]
-
Letters[Round] = randomLetter.Name
-
end
-
for count = 1, Round do
-
print(Letters[Round])
-
end
-
TrainingEvent:FireClient(player, Letters, Round)
– Local script currently , prints Nil for each
TrainingEvent.OnClientEvent:Connect(function(Letters, Round, typeofTraining)
for count = 1, Round do
print(Letters[Round])
end
local roundCompleted = false
local RoundOrder = 1
HotKeys(Letters, Round, typeofTraining, roundCompleted)
end)