GUI button not moving to exact mouse position

I want the GUI circle button to be moving at the position of the mouse, but its very off, its behind my mouse.

local Players = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer

local settingsFrame = script.Parent
local sliderButton = settingsFrame.VolumeSlider.SliderButton

local mouse = player:GetMouse()
local dragging = false
local hovering = true
local mouseButtonDown = false

local maxPosY = -0.149



local function moveGuiToMouse()
    local mouseLocation = UIS:GetMouseLocation()
    sliderButton.Position = UDim2.fromOffset(mouseLocation.X, mouseLocation.Y)
end

moveGuiToMouse()
RunService:BindToRenderStep("moveGuiToMouse", 1, moveGuiToMouse)

It’s because the “sliderButton” is inside “settingsFrame.VolumeSlider” and not the ScreenGui itself which what makes it be very off.

2 Likes

I forgot to say this but I fixed the problem yesterday but ty for the help anyways

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