The video is self explenatory, the card remains big, i don’t know why, i’ve been trying to fix it for 1 hour, but i can’t.
local function onMouseEnter(card : ImageLabel)
if isDragging then currentlyEnlargedCard = nil return end
if currentlyEnlargedCard and currentlyEnlargedCard ~= card then
pendingEnlargedCard = card
return
end
if not card:GetAttribute("IsBigger") then
currentlyEnlargedCard = card
card:SetAttribute("IsBigger",true)
card.Parent.ZIndex = 100 --La carta va in primo piano
tween = TweenService:Create(card,sizeTweenInfo,{Size = card:GetAttribute("OriginalSize") + PLUS_SIZE})
tween:Play()
end
end
local function onMouseLeave(card : ImageLabel)
if currentlyEnlargedCard ~= card then pendingEnlargedCard = nil return end --Quando esci da PendingEnlargedCard, ma non da CurrentlyEnlargedCard
if isDragging then return end
if card:GetAttribute("IsBigger") then
currentlyEnlargedCard = nil
card:SetAttribute("IsBigger",false)
card.Parent.ZIndex = card:GetAttribute("DefaultZIndex")
tween = TweenService:Create(card,sizeTweenInfo,{Size = card:GetAttribute("OriginalSize")})
tween:Play()
end
if pendingEnlargedCard and pendingEnlargedCard ~= card then
onMouseEnter(pendingEnlargedCard)
pendingEnlargedCard = nil
end
end
--Quando dragghi la carta, la puoi posizionare
local function onDragStart(card : ImageLabel)
isDragging = true
card.Parent.ZIndex = 100
if not card:GetAttribute("IsBigger") then
card:SetAttribute("IsBigger",true)
currentlyEnlargedCard = card
tween = TweenService:Create(card,sizeTweenInfo,{Size = card:GetAttribute("OriginalSize") + PLUS_SIZE})
tween:Play()
end
end
local function onDragEnd(card : ImageLabel)
isDragging = false
if tween and tween.PlaybackState == Enum.PlaybackState.Playing then
tween:Cancel()
end
tween = TweenService:Create(card,sizeTweenInfo,{Size = card:GetAttribute("OriginalSize")})
tween:Play()
currentlyEnlargedCard = nil
card.Parent.ZIndex = card:GetAttribute("DefaultZIndex")
card.Position = handFrame[card.Parent.Name].Position + UDim2.new(0.5,0,0.5,0)
card:SetAttribute("IsBigger",false)
if pendingEnlargedCard and pendingEnlargedCard ~= card then
onMouseEnter(pendingEnlargedCard)
pendingEnlargedCard = nil
end
end
External Media