Trouble with Tables

  1. What do you want to achieve? For the “osa” part to tween to the specified position when the numbers 9,4 and 1 have been clicked into their places in the TextLabels.

  2. What is the issue? The script completely broke after adding the “patalaput” table. Previously the TextLabels and their codes were just fine, and when you clicked to 9, 4 and 1 the “signaalI” block turned into “Lime Green” as stated. Now the parts where the TextLabels and their ClickDetectors are don’t work anymore, nothing does.

  3. What solutions have you tried so far? Formatting the tables differently and trying to see if there’s something wrong with them, didn’t result to anything however.

local arvo = script.Parent.kalikka1.SurfaceGui.TextLabel
local arvo2 = script.Parent.kalikka2.SurfaceGui.TextLabel
local arvo3 = script.Parent.kalikka3.SurfaceGui.TextLabel

local TweenService = game:GetService("TweenService")

local osa = script.Parent.wall

local patalaput = {osa.Position + Vector3.new(48,5.75,12.5)} -- Suspected problematic part

local parametrut = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

local osaTween = TweenService:Create(osa, parametrut, patalaput) -- Along with this

script.Parent.kalikka1.ClickDetector.MouseClick:Connect(function()
	local num = tonumber(arvo.Text)+1
	if num == 10 then
		num = 0
	end
	arvo.Text = num
end)

script.Parent.kalikka2.ClickDetector.MouseClick:Connect(function()
	local num2 = tonumber(arvo2.Text)+1
	if num2 == 10 then
		num2 = 0
	end
	arvo2.Text = num2 
end)

script.Parent.kalikka3.ClickDetector.MouseClick:Connect(function()
	local num3 = tonumber(arvo3.Text)+1
	if num3 == 10 then
		num3 = 0
	end
	arvo3.Text = num3
	if arvo.Text == "9" and arvo2.Text == "4" and arvo3.Text == "1" then
		script.Parent.signaali.BrickColor = BrickColor.new ("Lime green")
		osaTween:Play()
	end
end)

The final parameter of Create is actually a dictionary, not an array. You need to specify what property is being changed.

local patalaput = {Position = osa.Position + Vector3.new(48,5.75,12.5)}
1 Like