How to prevent the buttons from going lower than they should?

Hey! When a player pass the mouse fast between the buttons the buttons get lower, Here is my script, Is the same script for every button.

Script:

local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")

local EventFolder = ReplicatedStorage.GameStructureEvents
local InfoPreset1 = TweenInfo.new(0.05, Enum.EasingStyle.Sine, Enum.EasingDirection.Out, 0, false, 0)
local Button = script.Parent.Action
local Frame = script.Parent

local Cooldown = false

-- This script was totally made by Kolda Studio's. --

Button.MouseEnter:Connect(function()
	TweenService:Create(Frame, InfoPreset1, { Position = Frame.Position-UDim2.fromScale(0, 0.01) }):Play()
end)

Button.MouseLeave:Connect(function()
	TweenService:Create(Frame, InfoPreset1, { Position = Frame.Position+UDim2.fromScale(0, 0.01) }):Play()
end)

Also, Here is a video

External Media

There’s an easy way to fix this (at least I hope so). You need to change this script. Before using the mouse events declare tweens and call these tweens inside of the events (now you are creating tweens from scratch every time when a mouse event is fired).

1 Like

You were right! Thank you so much.

1 Like

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