Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Table values won't set to true or false?

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

2 comments

0

I'm still learning tables...

0

Anyone <3?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.