Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can this tweenservice position problem be fixed?

Hi So I made a gate for my game but for some reason it goes to this same position for example the position is at 173, 10.5, -66.4 I want to move it up by the y axis by 16 it does that but when I want it to go back to 173, 10.5, -66.4 it goes to 173, -5.5, -66.4. Got any answers to help this?

local tweenService = game:GetService("TweenService")
local button = script.Parent
local gate = workspace.Gate
local cooldown = true
local click = button:WaitForChild("ClickDetector")
local check = button:WaitForChild("CheckGate")

local gateInfoUp = TweenInfo.new(

	5,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	false,
	0.1

)

local gatePositionUp =
{

	Position = gate.Position + Vector3.new(0,16,0)

}

local gateInfoDown = TweenInfo.new(

	5,
	Enum.EasingStyle.Quad,
	Enum.EasingDirection.Out,
	0,
	false,
	0.1
	
)

local gatePositionDown = 
{

	Position = gate.Position - Vector3.new(0,16,0)

}

local gateOpenUp = tweenService:Create(gate,gateInfoUp,gatePositionUp)
local gateCloseDown = tweenService:Create(gate,gateInfoDown,gatePositionDown)

click.MouseClick:Connect(function()
	if cooldown == true then
		cooldown = false
		if check.Value == true then
			check.Value = false
			
			button.BrickColor = BrickColor.new("Bright green")
			gateCloseDown:Play()
		else
			check.Value = true
			
			button.BrickColor = BrickColor.new("Bright green")
			gateOpenUp:Play()
		end
		wait(6.25)
		cooldown = true
	end
end)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.