Hi, everyone! I would like to understand how am I supposed to make a function refreshing all the time.
-
What do I want to achieve?
I want the CanvasPosition of a ScrollingFrame not to be able to reach the origin. As well, when the CanvasPosition is inferior than 50, I reset it to 50 so it never can reach a lower value than 50. -
What is the issue?
My script works but the function isn’t enough reactive. I don’t want the scrolling frame to look laggy as it currently look like though. -
What solutions have I tried so far?
I’ve tried with awhile wait(0.0001) do
loop so it is repeated as fast as possible. Then, I went to the DevForum and I found thegame:GetService("RunService").Heartbeat:Connect(function())
way to do it, but sadly, same result occured.
Do you have any idea to solve my problem?
Here is my LocalScript content:
game:GetService("RunService").Heartbeat:Connect(function()
if script.Parent.CanvasPosition.Y < 50 then
script.Parent.CanvasPosition = Vector2.new(0, 50)
end
end)
And here is a video of what it looks:
I just want the function to happen as smooth as possible, so player don’t consider it as a bug or something of this type.
Thanks a lot by advance!