I want to make a function that when it is called, it plays a tween. I got an error that says “attempt to call a nil value” and couldn’t find a fix. Does anyone know how to fix it?
The script is a script for backpacks in simulators. Where currentBlocks is collected and maxBlocksValue is how much the backpack can hold.(They are both IntValues)
currentBlocks:GetPropertyChangedSignal(“Value”):Connect(tw)
if currentBlocks.Value >= maxBlocksValue.Value then
tw() -------------------------------------------------------------------This is where I get the error
endfunction tw()
if currentBlocks.Value >= maxBlocksValue.Value then
gui.Visible = true
print(“a”)local TS = game:GetService("TweenService") local Info = TweenInfo.new( 2, Enum.EasingStyle.Cubic, Enum.EasingDirection.InOut, -1, true, 0 ) local tween = TS:Create(gui.Arrow, Info, {Position = UDim2.new(-0.666, 0,-0.283, 0)}) while wait() do tween:Play() tween.Completed:Wait() if gui.Visible == false then break end end
end
end