#Tween not working

9 messages · Page 1 of 1 (latest)

celest elk
#
local player = game.Players.LocalPlayer
local statistics = player:WaitForChild("Statistics")
local cash = statistics.Cash

local rs = game:GetService("ReplicatedStorage")
local tweenSerivce = game:GetService("TweenService")
local text = rs.Text

local start = UDim2.new(0.128, 0,0.484, 0)
local goal = UDim2.new(0.128, 0,0.407, 0)

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0, false, 0.4)


cash:GetPropertyChangedSignal("Value"):Connect(function()
    local clone = text:Clone()
    clone.Parent = script.Parent
    clone.Position = start
    
    local tween = tweenSerivce:Create(clone,tweenInfo, goal)
    tween()
    clone:Destroy()

end)```
#

Error: Unable to cast dictionary

slender reef
#

is that a LocalScript or a script

celest elk
slender reef
#
local player = game.Players.LocalPlayer
local statistics = player:WaitForChild("Statistics")
local cash = statistics.Cash

local rs = game:GetService("ReplicatedStorage")
local tweenSerivce = game:GetService("TweenService")
local text = rs.Text

local start = UDim2.new(0.128, 0,0.484, 0)
local goal = UDim2.new(0.128, 0,0.407, 0)

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0, false, 0.4)


cash:GetPropertyChangedSignal("Value"):Connect(function()
    local clone = text:Clone()
    clone.Parent = script.Parent
    clone.Position = start
    
    local tween = tweenSerivce:Create(clone,tweenInfo, {goal})
    tween()
    clone:Destroy()

end)```
#

Test

celest elk
slender reef
#
local player = game.Players.LocalPlayer
local statistics = player:WaitForChild("Statistics")
local cash = statistics.Cash

local rs = game:GetService("ReplicatedStorage")
local tweenSerivce = game:GetService("TweenService")
local text = rs.Text

local start = UDim2.new(0.128, 0,0.484, 0)
local goal = UDim2.new(0.128, 0,0.407, 0)

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0, false, 0.4)


cash:GetPropertyChangedSignal("Value"):Connect(function()
    local clone = text:Clone()
    clone.Parent = script.Parent
    clone.Position = start
    
    local tween = tweenSerivce:Create(clone,tweenInfo, {goal})
    tween:Play()
Wait(1.2)
    clone:Destroy()

end)```
#
local player = game.Players.LocalPlayer
local statistics = player:WaitForChild("Statistics")
local cash = statistics.Cash

local rs = game:GetService("ReplicatedStorage")
local tweenSerivce = game:GetService("TweenService")
local text = rs.Text

local start = UDim2.new(0.128, 0,0.484, 0)
local goal = {UDim2.new(0.128, 0,0.407, 0),

}

local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine,Enum.EasingDirection.In, 0, false, 0.4)


cash:GetPropertyChangedSignal("Value"):Connect(function()
    local clone = text:Clone()
    clone.Parent = script.Parent
    clone.Position = start
    
    local tween = tweenSerivce:Create(clone,tweenInfo, goal)
    tween:Play()
Wait(1.2)
    clone:Destroy()

end)```