-- Function to handle slider button click

local function onSliderButtonClick(button)
	-- Reset button colors
	norm.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
	fast.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
	max.BackgroundColor3 = Color3.fromRGB(255, 255, 255)

	-- Move the sliding indicator to the selected button
	local targetSize
	local targetSpeed

	if button == norm then
		targetSize = normalSize
		targetSpeed = normalSpd
	elseif button == fast then
		targetSize = fastSize
		targetSpeed = fastSpd
	elseif button == max then
		targetSize = maxSize
		targetSpeed = maxSpd
	end

	-- Set the uiSpeedUser to the selected speed modifier
	uiSpeedUser.Value = targetSpeed

	-- Check if the user has permission to change the islandSpeed
	if ClipSettings.settings.uiSpeedSetting then
		-- Update the islandSpeed setting in the ClipSettings module based on the uiSpeedUser
		ClipSettings.islandSpeed = uiSpeedUser.Value
	else
		-- Use the default islandSpeed from the ClipSettings module if uiSpeedSetting is off
		ClipSettings.islandSpeed = ClipSettings.islandSpeed
	end

	-- Animate the sliding indicator
	local tween = TweenService:Create(sliding, tweenInfo, {
		Size = targetSize
	})
	tween:Play()

	-- Highlight the selected button
	button.BackgroundColor3 = Color3.fromRGB(200, 200, 200)
end

