## UI Tween Script

1 messages · Page 1 of 1 (latest)

orchid hamlet
#

guys what is the fcking problem with my script the first color tween works normally but after that the cursor just teleport

#
local baseUi = script.Parent
local UIBlue = baseUi.Blue
local UIGreen = baseUi.Green
local UIYellow = baseUi.Yellow
local UIOrange = baseUi.Orange
local UIRed = baseUi.Red
local cursor = baseUi.Blue.Cursor

local tweenService = game:GetService("TweenService")
local remote = game.ReplicatedStorage.sixLegsRemotes.DadjiRemote
local colors = {UIBlue,UIGreen,UIYellow,UIOrange,UIRed}

local mouse = game.Players.LocalPlayer:GetMouse()
local UIS = game:GetService("UserInputService")
local held = false

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)
local tweenCursorForward = tweenService:Create(cursor, tweenInfo, {Position = UDim2.fromScale(1,0)})
local tweenCursorBackWard = tweenService:Create(cursor, tweenInfo, {Position = UDim2.fromScale(0,0)})
local tweenState = "Forward"

local function ForwardTween()
    local currentParent = cursor.Parent
    if currentParent == UIRed then
        tweenState = "BackWard"
        return 
    end
    cursor.Parent = colors[table.find(colors,currentParent) + 1]
    tweenCursorForward:Play()
    tweenService:Create(cursor.Parent,tweenInfo,{Transparency = 0}):Play()
    repeat task.wait() until tweenCursorForward.PlaybackState == Enum.PlaybackState.Completed 
end

local function BackwardTween()
    local currentParent = cursor.Parent
    if currentParent == UIBlue then
        tweenState = "Forward"
        return 
    end
    cursor.Parent = colors[table.find(colors,currentParent) - 1]
    tweenCursorBackWard:Play()
    tweenService:Create(cursor.Parent,tweenInfo,{Transparency = 0.6}):Play()
    repeat task.wait() until tweenCursorBackWard.PlaybackState == Enum.PlaybackState.Completed 
end

local function updateCursor()
    if tweenState == "Forward" then
        ForwardTween()
    elseif tweenState == "BackWard" then
        BackwardTween()
    end
end
#
UIS.InputBegan:Connect(function(input,gpe)
    if gpe then return end
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        remote:FireServer()
        tweenCursorForward:Play()
        tweenService:Create(cursor.Parent,tweenInfo,{Transparency = 0}):Play()
        held = true
        repeat task.wait() until tweenCursorForward.PlaybackState == Enum.PlaybackState.Completed 
        task.spawn(function()
            while held do
                if not held then
                    break
                end
                updateCursor()
            end

        end)
    end
end)

UIS.InputEnded:Connect(function(input,gpe)
    if gpe then return end
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        remote:FireServer()
        held = false
        local tween = (tweenCursorForward.PlaybackState == Enum.PlaybackState.Playing and tweenCursorForward) or tweenCursorBackWard
        tween:Cancel()
        cursor.Parent = UIBlue
        cursor.Position = UDim2.fromScale(0,0)
        for _, color in ipairs(colors) do
            color.Transparency = 0.6
        end

    end
end)
brave crane
#

UI.tween = true

orchid hamlet
#

What

#

@brave crane

potent bison
orchid hamlet
potent bison
#

idk man im js repeating

royal fjord
#

rs

orchid hamlet
orchid hamlet
#

Can a serious person answer me pls flushed

drowsy summit