Having trouble using tables for a build change script

Hey guys,

I am currently doing a building system like in the game " entrenched "
tho i have some issues like theses:

local function changebuild(direction)  --  chanegs build type
	if direction == "fwd" then
		currentBuildNum += 1
		
		if currentBuildNum > #Buildings then currentBuildNum = #Buildings end
		
		
	elseif direction == "bwd" then
		
	end
end

if currentBuildNum > #Buildings then currentBuildNum = #Buildings end

i want to know the number of the last item inside of the table
then i run a piece of code if it is working

Please do not write the code and leave but explain the different commands available to get to it
and how they work

thanks in advance, CaptainDragons

I’m not sure I fully understand what you’re trying to ask. If you want to access the last item in a table, you can just use Buildings[#Buildings]. Is that what you’re trying to do?

Excuse me i just forgot to put Keycode afet Input :[

The error was in the Input handler excuse me

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.