Value will not update

I want the value to update with each cube created

After each time duplicated, the value set to go up does not

I have tried changing the type of value, Changing how it accesses the value, and when it should update the value

Values = workspace.Values

while true do
	if Values.Boxes_In_World.Value < 5 then
		cuuube = script.Parent:Clone()
		cuuube.Script:Destroy()
		cuuube.CanCollide = true
		cuuube.Parent = workspace.Boxes
		cuuube.Anchored = false
		cuuube.Name = "Box"
		Values = Values.Boxes_In_World.Value + 1
		print("successfully created box!")
	end
	wait(2)
end
7 Likes

Change this to Values.Boxes_In_World.Value += 1

2 Likes

I have just tried your answer, unfortunately it gave me a syntax error… Thanks for trying to help though!

3 Likes

What was the syntax error it gave you?

1 Like

23:08:01.435 Workspace.Boxes.The box.Script:11: Expected identifier when parsing expression, got ‘+=’ - Studio - Script:11

1 Like

Maybe try Values.Boxes_In_World.Value = Values.Boxes_In_World.Value + 1

Thank you so much! It fixed both of my problems!

1 Like

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