"Unable to cast to Dictionary" While tweening sound playbackspeed

So i’m making a radio where if you click it the playbackspeed goes down using tween, Making an effect of it slowly turning off.

Somehow i get “Unable to cast to Dictionary” at the tweenservice:create() lines.

local TweenService = game:GetService("TweenService")

local TweenInf = TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0)
local Off = true

local TurnOn = TweenService:Create(script.Parent.Music.PlaybackSpeed, TweenInf, 1)
local TurnOff = TweenService:Create(script.Parent.Music.PlaybackSpeed, TweenInf, 0)

script.Parent.ClickDetector.MouseClick:Connect(function(clicker)
	if Off == true then
		script.Parent.Music:Play()
		TurnOn:Play()
		TurnOn.Completed:wait()
		Off = false
		
	elseif Off == false then
		Off = true
		TurnOff:Play()
		TurnOff.Completed:wait()
		script.Parent.Music:Pause()
		Off = true
			
	end
end)

I don’t know how to fix this, I have tried asking my friends but they don’t know either.

https://gyazo.com/855c30fa9b41588a3b347271b9faed74
(Line 6 is the tweenservice:create() lines)

TweenService:Create() takes an Instance, the TweenInfo and a propertyTable (which is a dictionary, and therefore it cannot cast the 1 to a dictionary).

You’ll want to give just the Music Sound Instance, the TweenInf and a dictionary with a key named PlaybackSpeed given the value of 1:

local TurnOn = TweenService:Create(script.Parent.Music, TweenInf, {PlaybackSpeed = 1})

Make sure to check the api-reference whenever you get unexpected errors, it may just solve your problem.

Sorry, I’m quite new at tweenservice so mistakes tend to come often, Anyways you said API?

Where can i find it or what even is it?

1 Like

The api-reference includes everything about the Roblox API, it’s great!

1 Like

Thanks a bunch, I’ll look more into it right now!