So lets suppose i have a meta table
local tablevalues = {"A","B","C"} local value = nil
so i wanted to know how could i switch these values in order for example when a keyboard key is pressed, i want to change value to one of these tablevalues value correctly in order, can someone help me? i am stil llearning meta tables...
Modify your script to this:
local tablevalues = {"A","B","C"} local NextTable = 1 game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function() print(tablevalues[NextTable]) --printing the next data val if NextTable == #tablevalues then --Checking if this is the last value of the table and we need to go back to pringing number 1 NextTable = 1 --Saying we need to go back to printing #1 else NextTable = NextTable+1 --If its not the last value, advance to the next value. end end)
This will work with as many values as you put in that table. You can keep adding if you desire. With further questions/comments/concerns, feel free to reply to my answer. Happy scripting! ~mc3334