When this code executes, the function CallMine() is supposed to be called once the Tween is finished. However, the CallMine() code executes as soon as I click. Any idea as to why?
Mouse.Button1Down:Connect(function()
Button1Down = true
if Equipped then
if Mouse.Target ~= nil and Mouse.Target:IsDescendantOf(workspace.Mine) then
block = Mouse.Target
mining = true
while mining == true and block == block do
ProgressBar:TweenSize(UDim2.new(0.96, 0, 0.7, 0), "InOut", "Sine", MineTime, false, function() CallMine(block.Parent) end )
mining = false
end
end
end
end)
function CallMine(block)
print(block)
BlockEvent:FireServer(block) -- block.Parent is the model, and block is the PrimaryPart.
end

1 comment
thanks for the in depth explanation. This is much more efficient (and works!) much appreciated!