![]() It is bound at, which has a value of 3000. The zooming function of the MouseWheel is done via the ContextActionService. If you have any ideas on how to solve this, let me know! The default camera script will zoom in when you scroll up, because the scroll input doesn’t count as processed by a GUI. PlayerGui.DescendantRemoving:Connect(DescendantRemoving) ![]() PlayerGui.DescendantAdded:Connect(DescendantAdded) If Descendant:IsA("ScrollingFrame") and Smoothed thenįor _, Descendant in pairs(PlayerGui:GetDescendants()) do Local function DescendantRemoving(Descendant) If Descendant:IsA("ScrollingFrame") and not Smoothed and not CollectionService:HasTag(Descendant, "DontSmooth") then Local function DescendantAdded(Descendant) Local SmoothScroll = require(script.SmoothScroll) Local PlayerGui = Player:WaitForChild("PlayerGui") local CollectionService = game:GetService("CollectionService") This code is currently running in Lua Learning! It's super useful. This example automatically smooths any ScrollingFrame in your game except ones that you tag with "DontSmooth" via ColectionService. ![]() SmoothScroll.Enable(ScreenGui.ScrollingFrame) Local ScreenGui = :WaitForChild("PlayerGui"):WaitForChild("ScreenGui") ![]() Simple use example local SmoothScroll = require(script.SmoothScroll) If you find an error case that does, let me know! This means the module should never halt or break your code. It’s also coded defensively, so even if you mess up, it’ll either use default or just ‘warn’ and not smooth it. The ScrollingFrame object to remove smoothing from If left out, will default to whichever Axis is scrollable or “Y” if both are valid What the velocity is multiplied by each frame (Clamped between 0.2 and 0.99) How many pixels it scrolls per wheel turn The ScrollingFrame object to apply smoothing to (I used Rodocs to document the module, and I highly recommend it.) function SmoothScroll.Enable(Frame, Sensitivity, Friction, Inverted, Axis) You use regular ScrollingFrames when creating your GUIs, and just tell the module to make it smooth. Implementation and usage is incredibly easy. One way was made out of multiple frames and required you to completely change your code, others are hard coded to a single frame, etc. I’ve seen a couple weird ways people have done it, none of them easy to just plug into your game. (These GIFs are 25FPS, but the smooth version is juicy in game at 60FPS.) Default: This module is designed for my case, but I’m sure many of you could use it as well. My game ( Lua Learning) is a lot of reading, so being able to scroll without losing track is a big deal. If there’s text in a ScrollingFrame, it’s hard to read because when you scroll it jumps and you lose your place. Scrolling on them jumps the CanvasPosition around, and they have no inertia at all. ScrollingFrames on PC are painful to use. I view this as a feature, but it’s worth noting that slower devices will scroll slower. It is tied to framerate, so it’ll scroll smoothly regardless of FPS. Besides, we might find some use for it again in the future, who knows. I’m leaving the post below for documentation + posterity. Until that day, this is what I’ll be using! I’m certain that one day, Roblox will make this behavior the default. I hope you all benefited from it, and I’m glad to see Roblox improving the platform so modules like these are unnecessary! We had a good long run here, and I know this module helped a lot of people while it was around. In Update 421, Roblox added smooth scrolling to ScrollingFrames.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |