• Home
  • Popular
  • Login
  • Signup
  • Cookie
  • Terms of Service
  • Privacy Policy
avatar

Posted by User Bot


30 Nov, 2024

Updated at 02 Dec, 2024

Visibility/tweening doesn't work

designing a complicated number line UI and it just doesn’t show/animate. the idea is when you press the button a condensed and small version of a number line shows up but after a tiny bit it tweens out to the actual number line with interactable buttons (functionality not programmed yet)

problem is nothing shows up when i press the button. my script is huge so i warn you

local Out = {
	["arrowleft"] = UDim2.new(0.04,0,0.5,0),
	["arrowright"] = UDim2.new(0.953,0,0.5,0),
	["linepos"] = UDim2.new(0.5,0,0.5,0),
	["linesize"] = UDim2.new(0,425,0,3),
	["one"] = true,
	["two"] = true,
	["zero"] = true,
	["onefive"] = true,
	["zerofive"] = true,
	["containerpos"] = UDim2.new(0.5,0,0.85,0),
	["containersize"] = UDim2.new(0,450,0,40),
	["containerUIARC"] =  11.25,
	["lineUIARC"] = 141.667
}
local In = {
	["arrowleft"] = UDim2.new(0.25,0,0.5,0),
	["arrowright"] = UDim2.new(0.743,0,0.5,0),
	["linepos"] = UDim2.new(0.5,0,0.5,0),
	["linesize"] = UDim2.new(0,30,0,3),
	["one"] = false,
	["two"] = false,
	["zero"] = false,
	["onefive"] = false,
	["zerofive"] = false,
	["containerpos"] = UDim2.new(0.5,0,0.85,0),
	["containersize"] = UDim2.new(0,50,0,40),
	["containerUIARC"] =  1.25,
	["lineUIARC"] = 10
}
local state = "In"
local isVisible = false
local bar = script.Parent.scalecontainer
local button = script.Parent.container.timescale
local line = bar.line
local one = line.one
local two = line.two
local zero = line.zero
local zerofive = line.zerofive
local onefive = line.onefive
local arrowleft = bar.arrowleft
local arrowright = bar.arrowright
local ts = game:GetService("TweenService")
local tiout = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local tiin = TweenInfo.new(0.5,Enum.EasingStyle.Sine,Enum.EasingDirection.In)
local rs = game:GetService("RunService")
local db = false
local visibilityState = false

function TweenOut(	)
	ts:Create(arrowleft,tiout,{Position = Out["arrowleft"]}):Play()
	ts:Create(arrowright,tiout,{Position = Out["arrowright"]}):Play()
	ts:Create(line,tiout,{Position = Out["linepos"], Size = Out["linesize"]}):Play()
	ts:Create(bar,tiout,{Position = Out["containerpos"], Size = Out["containersize"]}):Play()
	task.wait(0.75)
	one.Visible = Out["one"]
	two.Visible = Out["two"]
	zero.Visible = Out["zero"]
	zerofive.Visible = Out["zerofive"]
	onefive.Visible = Out["onefive"]
	bar.UIAspectRatioConstraintBar.AspectRatio = Out["containerUIARC"]
	line.UIAspectRatioConstraintLine.AspectRatio = Out["lineUIARC"]
end

function TweenIn()
	one.Visible = In["one"]
	two.Visible = In["two"]
	zero.Visible = In["zero"]
	zerofive.Visible = In["zerofive"]
	onefive.Visible = In["onefive"]
	bar.UIAspectRatioConstraintBar.AspectRatio = In["containerUIARC"]
	line.UIAspectRatioConstraintLine.AspectRatio = In["lineUIARC"]
	ts:Create(arrowleft,tiin,{Position = In["arrowleft"]}):Play()
	ts:Create(arrowright,tiin,{Position = In["arrowright"]}):Play()
	ts:Create(line,tiin,{Position = In["linepos"], Size = In["linesize"]}):Play()
	ts:Create(bar,tiin,{Position = In["containerpos"], Size = In["containersize"]}):Play()
	task.wait(0.75)
end

function visibilityToggle(visibility)
	if visibility then
		if not visibilityState then
			visibilityState = true
			bar.Visible = true
			arrowright.Visible = true
			arrowleft.Visible = true
			line.Visible = true
			TweenIn()
		end
	else
		if visibilityState then
			visibilityState = false
			TweenOut()
			bar.Visible = false
			arrowright.Visible = false
			arrowleft.Visible = false
			line.Visible = false
		end
	end
end

button.Activated:Connect(function() -- good luck trying to read this lol
	if not db then db = not db end
	if visibilityState then visibilityState = not visibilityState else visibilityState = not visibilityState end
	if state == "In" then state = "Out" visibilityToggle(visibilityState) task.wait(0.5) TweenOut() elseif state == "Out" then state = "In" visibilityToggle(visibilityState) task.wait(0.5) TweenIn() end
	task.wait(2)
	db = not db
end)

1 post - 1 participant

Read full topic