If you click the Frame while your mouse is over it, it will fire MouseEnter again.
function tweentrans() end script.Parent.MouseEnter:connect(function() print("1") inFrame = true tweentrans() end) script.Parent.MouseLeave:connect(function() print("2") inFrame = false end)
the reason why this happened is the same reason why when you touch a brick on a touch event with a print('random text') it will print it multiple times because your constantly on it. however if we add some debouncers and if statments (which will stop the code from running more than you need it to) then youll be able to control the monstrosity.
local inFrame = true -- this is out debouncer function tweentransformation() end script.Parent.MouseEnter:connect(function() if inFrame then -- checks to see if inFrame == true inFrame = false --[[this is so it doesnt reprint(1) until we set it to true--]] print("1") tweentransformation() -- [[places the function in here so the mouseleave function can only fire when it has been inside the frame --]] script.Parent.MouseLeave:connect(function() if not inFrame then --[[checks if inFrame == false. so adding wait()'s in perfectly fine.--]] print("2") inFrame = true --[[put inFrames to true so MouseEnter() can play again--]] end -- end if statment end) -- end function end -- to end the if statement end) -- end function