UIStroke Bug? Changing the thickness on .MouseEnter

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    When the mouse enters a frame the UIStroke thickness goes to 1.5 and back to 0 when the mouse leaves.

  2. What is the issue? Include screenshots / videos if possible!
    Whenever the UIStroke thickness changes it’ll instantly change back, even if I try to manually do it in Explorer
    When the mouse hovers
    When I try to manually change it

    there’s no loops or anything making it revert to it’s original thickness.

Hey! There might be a problem with your script. Can you provide it?

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local SoundService = game:GetService("SoundService")

local actionHolder = script.Parent:WaitForChild("actionHolder")
local top = script.Parent:WaitForChild("top")
local pages = actionHolder:WaitForChild("Pages")

local UiSounds = SoundService:WaitForChild("Ui")

local numPages = #pages:GetChildren() - 1
local pageNumber = 1

-->> Animations
local function enterFrame(frame)
	if frame == nil then return end
	if frame:FindFirstChild("UIStroke") and frame:FindFirstChild("UICorner") then
		local UIStroke = frame.UIStroke
		local UICorner = frame.UICorner
		local TweenTime = .1
		UiSounds:WaitForChild("TabChange"):Play()
		local tween = TweenService:Create(UICorner, TweenInfo.new(TweenTime), {CornerRadius = UDim.new(0.2,0)}):Play()
		local tween = TweenService:Create(UIStroke, TweenInfo.new(TweenTime), {Thickness = 1.5}):Play()
	else
		return end
end
local function exitFrame(frame)
	if frame == nil then return end
	if frame:FindFirstChild("UIStroke") and frame:FindFirstChild("UICorner") then
		local UIStroke = frame.UIStroke
		local UICorner = frame.UICorner
		local TweenTime = .1
		local tween = TweenService:Create(UICorner, TweenInfo.new(TweenTime), {CornerRadius = UDim.new(0.6,0)}):Play()
		local tween = TweenService:Create(UIStroke, TweenInfo.new(TweenTime), {Thickness = 0}):Play()
	else
		return end
end
-->> Animation Connection
for i,v in pairs(pages:GetDescendants()) do
	if v:IsA("Frame") then
		if v:FindFirstChild("UIStroke") and v:FindFirstChild("UICorner") then
			v.MouseEnter:Connect(function()
				enterFrame(v)
			end)
			v.MouseLeave:Connect(function()
				exitFrame(v)
			end)
		end
	end
end

I don’t think it’d be a problem with the script because even if I manually change it in explorer, it just goes back to the old thickness. There’s no loops anywhere causing this

Might have a problem to do with MouseEnter / MouseLeave.

I recommend checking out this module to handle MouseEnter / MouseLeave more effectivly as they aren’t always accurate.

I appreciate the module link, I always love to use modules to improve efficiency. However I doubt that it’s anything to do with the mouse connections as the other tween plays perfectly as shown in the first gif. And in the second gif when I manually change it in explorer playergui it reverts instantly to 0 thickness as well leading me to think this is ROBLOX related

It’s working for me in studio.

It might be a problem with another one of your scripts?

Can I see the path to the gui?

Basic structure.
image

The content of the script is what your using.

I appreciate you helping me look into it. I figured out the problem. I have a module called UIStrokeAdjuster Module and disabling this module fixed it.

Anyways, thanks again!

1 Like

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