Attribute bool value wont change

I have a drawer open and close function the attribute “IsOpen” should be set to “not Isopen” which is basically the opisite of it’s current state however it stays as false and doesnt change.
script:

function furniture.OpenDrawer(drawer)
	drawer:SetAttribute("Moving", true)

	local isOpen = drawer:GetAttribute("Open")
	local Direction = isOpen and 1 or -1
	print(isOpen)

	local cframe = drawer.CFrame * CFrame.new(0,0,1.5 * Direction)
	local drawerTween = TweenService:Create(drawer, TweenInfo.new(0.5), {CFrame = cframe})

	drawerTween:Play()
	drawerTween.Completed:Wait()
	drawerTween:SetAttribute("Moving", false)
	drawerTween:SetAttribute("Open", not isOpen)
	print(isOpen)
end

You are setting the attribute of a tween…
also you are printing isopen, the value obviously won’t change. Try printing getattribute.

oh my god I was looking for the issue for so long and it was right infront of me :face_exhaling:

Happens to the best of us.
30chars

1 Like

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