Hi, this is my code:
local holding = false
UIS.InputBegan:Connect(function(Object)
if Object.UserInputType == Enum.UserInputType.MouseButton1 then
if CheckForHolding(script.Parent.Inventory.hola) then
holding = true
oldpos = script.Parent.Inventory.hola.Position
UIS.MouseIconEnabled = false
while (true) do
if not holding then
break
end
wait()
script.Parent.Inventory.hola.Position = calculate()
--game:GetService('TweenService'):Create(script.Parent.Inventory.hola,TweenInfo.new(0.6,Enum.EasingStyle.Sine),{Position = calculate()}):Play()
end
end
end
end)
UIS.InputEnded:Connect(function(Object)
if Object.UserInputType == Enum.UserInputType.MouseButton1 then
holding = false
script.Parent.Inventory.hola.Position = oldpos
UIS.MouseIconEnabled = true
for i,v in pairs(script.Parent.Inventory.Slots:GetChildren()) do
if CheckForHolding(v) then
print('Ok')
script.Parent.Inventory.hola.Position = v.Position
holding = false
break
end
end
end
end)
All works fine, but for some reason this happens:
https://gyazo.com/d56e505df43bdc69658bd5dd9b34e02d
Any idea why?
Basically, it goes to âvâ position, and goes back to mouse