UIStroke clone not showing up when playtesting

Hello, I’m having an issue with UIStrokes, whenever I clone one the cloned one does not show up when playtesting, although it does show up in the explorer, I’ve provided a gif to show the issue and the snippet of code that handles the cloning of the UIStroke.

local function AnimateButton(button:ImageButton, originalSize:UDim2, action:string, state:boolean)
	local originalOutline = button:FindFirstChildWhichIsA("UIStroke")
	
	if action == "hover" then
		button:TweenSize((state and originalSize + UDim2.new(0.03, 0, 0.03, 0)) or originalSize, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.25, true)
	elseif action == "press" then
		if originalOutline then
			local newoutline = originalOutline:Clone()
			local thicktween = TweenService:Create(newoutline, TweenInfo.new(1), {Thickness = 50})
			local transptween = TweenService:Create(newoutline, TweenInfo.new(1), {Transparency = 1})
			
			newoutline.Parent = button
			newoutline.Thickness = originalOutline.Thickness
			newoutline.Transparency = 0
			newoutline.Enabled = true
			
			thicktween:Play()
			transptween:Play()
			
			thicktween.Completed:Connect(function()
				newoutline:Destroy()
			end)
		end
		
		button.Size = originalSize - UDim2.new(0.03, 0, 0.03, 0)
		button:TweenSize(originalSize, Enum.EasingDirection.Out, Enum.EasingStyle.Back, 0.5, true)
	end
end
1 Like

maybe because there is already another UIStroke?

a fix could be
(from what I’ve read)

originalOutline.Transparency = 1

after the tween you can change the transparency back

maybe because there is already another UIStroke?

Ah, I did not know UIStrokes behaved like that, I’ll find a solution from here, thank you.


image
image
the pink doesn’t work due to the other uistroke

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