#Tween doesnt play

1 messages · Page 1 of 1 (latest)

gray cosmos
#

So I want like a bar to fill when I charge my attack so like I made this script here(this is only a part of a script)

uis.InputBegan:Connect(function(input, gpe)
    if gpe then return end
    if input.KeyCode == Enum.KeyCode.Three and not debounce then
        debounce = true
        canrun = false
        hum.WalkSpeed = 0
        game.ReplicatedStorage.RE.Sprint:FireServer("End")
        local chargeanim =  hum.Animator:LoadAnimation(rs.Fx.Animation2)
        chargeanim:Play()
        Bar.Size = UDim2.new({0, 0},{0, 0})
        Bar.Parent.Visible = true
        Bar:TweenSize(UDim2.new({0, 270},{1, 0}),
            Enum.EasingDirection.In,
            Enum.EasingStyle.Sine,
            5
        )
        hum.JumpHeight = 0
        charging = true
        local data = {
            character = character,
            action = "Charge"
        }
        re:FireServer(data)
        
        local mod = MOD
        repeat
            task.wait(.1)
            mod += .04
        until charging == false or mod > MAXMOD or hum.Health <= 0
        if hum.Health <= 0 then return end
        chargeanim:Stop()
        Bar.Parent.Visible = false
        wait(0.2)
        hum.Animator:LoadAnimation(rs.Fx.Animation):Play()
        wait(.6)
        camShake:ShakeOnce(2, 5, .2, .4)
        data = nil
        data = {
            character = character,
            action = "Release",
            CFrame = character.HumanoidRootPart.CFrame,
            charge = mod,
        }
        effect(data.CFrame, mod)
        re:FireServer(data)
        data= nil
    end
end)

but like the tween doesnt plays..

bold pecan
#

dont you have to :Play() the tweensize?

gray cosmos
#

ok I try

#

no does nothing just gives me an error that you dont need :Play()

bold pecan
#

oh

gray cosmos
#

I thinks thats just for 3d objects

#

that you have to play it

gray cosmos
# bold pecan oh

So i just made a test script to play the tween I also changed like to the Tweenservice because the old is deprecated I think but its still not working

#
local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Bar
local Bar = gui.Frame
local ts = game:GetService("TweenService")

local Tweengui = ts:Create(Bar, 5 , Bar.Size == UDim2.new({0, 270},{1, 0}))

wait(1)

Tweengui:Play()
#

thats like the testscript and I get the error

#

Unable to cast to Dictionary

bold pecan
#

Why ==?

#

Create expect a table with the proprieties to tween, therefore its {["Size"] = UDim2.new(the size and whatever)}

Also, you can call :Play after the create brackets instead of creating an instance of it

#

@gray cosmos