One of my buttons in my main menu is not tweening

local StartUI = script.Parent
local Events = StartUI:WaitForChild("Events")
local SFX = StartUI:WaitForChild("SFX")

local UIS = game:GetService("UserInputService")
local TS = game:GetService("TweenService")

local Title = StartUI:WaitForChild("Title")
local Pointer = StartUI:WaitForChild("Pointer")

local OldSpot = 1
local Spot = 1
local OS = .05
local CD = false

local White = Color3.new(1,1,1)
local Gray = Color3.new(0.85098, 0.85098, 0.85098)

UIS.MouseIconEnabled = false

function CDF()
	CD = true
	task.wait(.41)
	CD = false
end

function Select()
	local CurS = StartUI:WaitForChild(Spot)
	local OldS = StartUI:WaitForChild(OldSpot)
	task.wait(.2)
	CurS.ImageColor3 = Gray
	OldS.ImageColor3 = White
	CurS:TweenSize(
		UDim2.new(CurS.Size.X.Scale,CurS.Size.X.Offset,CurS.Size.Y.Scale + .01,CurS.Size.Y.Offset),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		.3)
	OldS:TweenSize(
		UDim2.new(OldS.Size.X.Scale,OldS.Size.X.Offset,OldS.Size.Y.Scale - .01,OldS.Size.Y.Offset),
		Enum.EasingDirection.Out,
		Enum.EasingStyle.Back,
		.3)
	print(OldS)
end

function PointerMove()
	local POS = Pointer.Position
	Pointer:TweenPosition(UDim2.new(POS.X.Scale,0,POS.Y.Scale+OS,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,.4,false)
	Select()
	CDF()
	SFX:WaitForChild("SelectSFX"):Play()
end

function Round(A)
	return math.floor(A * 10) / 10
end

function onInput(input,gpe)
	if gpe or CD == true then
		return
	elseif input.KeyCode == Enum.KeyCode.W and Spot ~= 1 then
		OldSpot = Spot
		Spot -= 1
		OS = -.1
		PointerMove()
	elseif input.KeyCode == Enum.KeyCode.S and Spot ~= 2 then
		OldSpot = Spot
		Spot += 1
		OS = .1
		PointerMove()
	end
	Round(Spot)
	print("Running through")
end

UIS.InputBegan:Connect(onInput)

image



image

the round function is in there because someone trying to help me told me because " 1. sometimes saying “+1 to this number” could make it “2.0000000018"”

main functions you need to care about: Select, and input
under the screengui the buttons are named numbers, and selecting things changes that number.

i know i have the variables setup correctly because the setting button turns gray when i select it

also provided the properties of the settings button if you need that

Never use these again
image


slight edits and heres the final result

worth it? no

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