Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Table values won't set to true or false?

Asked by 8 years ago
Edited 8 years ago

So I made a gui with 'check boxes' and when you click one 'box' it should change the corisponding values to true or false, I'll include a model so you can see it for yourself. I don't get any errors, it just won't work. https://www.roblox.com/Thanks-ScriptingHelpers-item?id=456562045 ^^ Model thanks

local faces = script.Parent.Face
local FacesTable = {
    Back = false,
    Bottom = false,
    Front = false,
    Left = false,
    Right = false,
}
for index, child in pairs(faces:GetChildren()) do
    child.Display.MouseButton1Click:connect(function()
        CheckVars()
        local var = nil
        local vartab
        for i, v in pairs (FacesTable) do
            if i == child.Name then
                print(i .. " = " .. tostring(v))
                print("Value found!")
                var = v
                vartab = i
        if v == false then
            print("var was false")
            v = true
            print(vartab .. " = " .. tostring(v))
            child.Display.Style = 1
            return
            elseif v == true then
            print("var was true")
                    v = false
                    print(vartab .. " = " .. tostring(v))
                    return
                end
            end
            child.Display.Style = 2
            return
            end
        end)
end
function CheckVars()
    for i, v in pairs (FacesTable) do
        print(tostring(i) .. " = " .. tostring(v))
    end
end
0
I'm still learning tables... xXharvest109Xx 25 — 8y
0
Anyone <3? xXharvest109Xx 25 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Anyone know how to bump? This got flooded away. And I know they are going to spas out if I make another post.

Ad

Answer this question