#Tween PROBLEM

10 messages · Page 1 of 1 (latest)

brisk kestrel
#

Im trying to make a gui component that goes up while holding down click and down when not holding it. For some reason it will go up but not down

frozen pineBOT
#

studio** You are now Level 6! **studio

brisk kestrel
ivory tinsel
#

you didn't change properties2

brisk kestrel
ivory tinsel
#

how it should go down if you don't change position?

brisk kestrel
#

so when its played the bar only goes up but not down

#
local tweenService = game:GetService("TweenService")
local uis = game:GetService("UserInputService")

--gui stuff--
local gui = script.Parent
local BackGround = script.Parent.BackGround
local BackGroundPosition = Vector3.new({0.193, 0},{0.197, 0})


local FishHolder = BackGround.Bar.FishHolder
local properties1 = {
    ["Position"] = UDim2.new({0, 0},{0, 0})
}

local properties2 = {
    ["Position"] = UDim2.new({0, 0},{0.84, 0})
}

local tweeninfo = TweenInfo.new(5, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local tweeninfo2 = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local tweenUp = tweenService:Create(FishHolder, tweeninfo, properties1)
local tweenDown = tweenService:Create(FishHolder,tweeninfo2,properties2 )

local holding = false




local function UpdateBar()
    if holding then
        tweenDown:Pause()
        tweenUp:Play()
        print("up")
    else
        tweenUp:Pause()
        tweenDown:Play()
        print("down")
    end
end


uis.InputBegan:Connect(function(input,gp)
    if not gp then return end
    if input.UserInputType == Enum.UserInputType.MouseButton1 and not holding and gui.Enabled then
        holding = true
        UpdateBar()
    end
end)

uis.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 and holding then
        holding = false
        UpdateBar()
    end
end)

Event.OnClientEvent:Connect(function()
    gui.Enabled = true
end)```