So all the wrong
Because, I got tangled in that
I have 2x CheckCombination
function checkCombination(stateA, stateB, stateC, stateD)
and
checkCombination(Kombinace.currentCombination[1], Kombinace.currentCombination[2], Kombinace.currentCombination[3], Kombinace.currentCombination[4]) -- Kontrola kombinace
currentCombination are data from modulescipt
Just RemoteEvent coughs on me
Old variant ModuleScript âKombinaceâ with numbers â0 â downâ and â1 â upâ
It also didnât work, because RemoteEvent dont send DATA
print("KOMBINACE SCRIPT")
local Kombinace = {}
-- PevnÄ danĂĄ kombinace
Kombinace.currentCombination = "kombinace2"
local kombinaceData = {
kombinace1 = {0, 1, 0, 0},
kombinace2 = {1, 0, 1, 0},
kombinace3 = {1, 1, 0, 0},
kombinace3 = {0, 1, 0, 1},
kombinace4 = {1, 1, 1, 0},
Kombinace5 = {0, 0, 1, 1},
Kombinace6 = {1, 1, 0, 0},
Kombinace7 = {0, 1, 1, 0},
Kombinace8 = {1, 0, 0, 1},
Kombinace9 = {1, 0, 0, 0},
Kombinace10 = {0, 0, 1, 0},
Kombinace11 = {1, 1, 1, 1},
Kombinace12 = {0, 1, 1, 1},
Kombinace13 = {0, 0, 0, 1},
Kombinace14 = {1, 0, 1, 1},
}
local currentPositions = {0, 0, 0, 0}
function Kombinace:setPosition(lever, position)
if lever == "A" then
currentPositions[1] = position == "Position1" and 0 or 1
elseif lever == "B" then
currentPositions[2] = position == "Position1" and 0 or 1
elseif lever == "C" then
currentPositions[3] = position == "Position1" and 0 or 1
elseif lever == "D" then
currentPositions[4] = position == "Position1" and 0 or 1
end
end
function Kombinace:checkCombination(positionA, positionB, positionC, positionD)
if typeof(positionA) == "Instance" then
print("positionA je instance.")
else
print("positionA nenĂ instance.")
end
if typeof(positionB) == "Instance" then
print("positionB je instance.")
else
print("positionB nenĂ instance.")
end
if typeof(positionC) == "Instance" then
print("positionC je instance.")
else
print("positionC nenĂ instance.")
end
if typeof(positionD) == "Instance" then
print("positionD je instance.")
else
print("positionD nenĂ instance.")
end
local combinationName = "kombinace" .. positionA .. positionB .. positionC .. positionD
local combination = kombinaceData[combinationName]
print("COMBINATION", combination)
print("Obsah kombinace2:")
local kombinace2 = kombinaceData.kombinace2
for i, value in ipairs(kombinace2) do
print("Pozice", i, "=", value)
end
if combination then
for i = 1, 4 do
print("AktuĂĄlnĂ kombinace:", combination[i])
if combination[i] ~= currentPositions[i] then
return false
end
end
return true
else
error("NeplatnĂĄ kombinace!")
end
end
print("Obsah kombinace2:")
local kombinace2 = kombinaceData.kombinace2
for i, value in ipairs(kombinace2) do
print("Pozice", i, "=", value)
end
-- PĹidejme pevnÄ danou kombinaci k objektu Kombinace
Kombinace.currentCombination = kombinace2
print("KOMBINACE DATA", Kombinace, kombinaceData)
return Kombinace
Cody