Problem with tweening ( Unable to cast to Dictionary )

hello,

I want to make a script where I tween the size of an object to be bigger. The script works when I press a button on my keyboard but every time it is pressed it says " Unable to cast to Dictionary "

Can anyone explain to me what is it and how to fix it because i am planning to use more tweens.

local TweenService = game:GetService("TweenService")

local Roomenabled = true


script.Fire.OnServerEvent:Connect(function(player, ability)
	
	if ability == "Room" then
		
		if not Roomenabled then return end
		
		local ROOM = Instance.new("Part")
		
		ROOM.Position = player.Character.HumanoidRootPart.Position
		ROOM.CanCollide = false
		ROOM.Anchored = true
		ROOM.Parent = game.Workspace
		ROOM.Transparency = 0.5
		ROOM.Shape = Enum.PartType.Ball
		ROOM.Color = Color3.new(0.266667, 0.466667, 0.827451)
		ROOM.Material = Enum.Material.SmoothPlastic
		
		
		local EndSize = Vector3.new(115,115,115)

		local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out, 0, true, 5)

		local tween = TweenService:Create(ROOM, tweenInfo, EndSize)
		
		tween:Play()
	end
	
	
	

	
end) 

Thanks for your time.

1 Like

the goal must be inside a table like this

local tween = TweenService:Create(ROOM, tweenInfo, {Size = EndSize})
3 Likes

Change this

local tween = TweenService:Create(ROOM, tweenInfo, EndSize)

To this

local tween = TweenService:Create(ROOM, tweenInfo, {EndSize})

You might be wondering why, well because in TweenService you will have to make their properties inside a table…
Here is an example

local TweenService  = TweenService:Create(AnyObject, TweenInfo.new() -- you can add properties inside the tween info if you would like.., {Transparency = 1}
1 Like