"Unable To Cast to dictionary" line 7

So I was trying to make a script that when your hp gets onto a specific ammount it will slow you down and play a tween,
on line 7 it says: “Unable to cast to dictionary”. Why so?
here is the script

    local camera = workspace.Camera
    local tw = game:GetService("TweenService")
    local target = {}
    target.FieldOfView = 120
    local tweeninfo = TweenInfo.new(0.8,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,4,true,0.1)
    local final = tw:Create(workspace.Camera,target,tweeninfo)
    game:GetService("RunService").Heartbeat:Connect(function()
        local h = script.Parent.Humanoid
        if h then
            if h.Health <= 35 then
                h.WalkSpeed = 10
                final:Play()
                script.Sound:Play()
                game.StarterGui.SlowOnDamage.Frame.BackgroundTransparency = 0.3
            else
                script.Sound:Stop()
                h.WalkSpeed = spd
                game.StarterGui.SlowOnDamage.Frame.BackgroundTransparency = 1
            end
        end
    end)

You got the order of arguments wrong for TweenService:Create().

(TweenInfo is second, not the target)

3 Likes

Please format your code properly with three backticks:

Like this:

```