"Unable to cast to Dictionary" problem with tweenservice, position, and sizes

I was just making some kind of “travelling merchant” system that will randomly spawn at anytime with a really low chance. I want to make so that before the merchant arrives, there will be some kind of light beam coming from the sky with tweenservice, and then seconds later the beam is gone and the merchant spawned there. Here’s the code:

local merchant		= game:GetService("ReplicatedStorage"):WaitForChild("Merchant")
local merchantvfx	= game:GetService("ReplicatedStorage"):WaitForChild("MerchantVFX")
local ts			= game:GetService("TweenService")
local atick			= 0.0000001 -- 1 tick = 100 nanoseconds


local function merchantspawn()
	local merchantvfxc = merchantvfx:Clone()
	merchantvfxc.Parent= workspace
	ts:Create(merchantvfxc.Cylinder, TweenInfo.new(1, Enum.EasingStyle.Circular), {Size = 2048, 18.6, 18.6}):Play()
	ts:Create(merchantvfxc.Cylinder, TweenInfo.new(1, Enum.EasingStyle.Circular), {Position = -33.1, 513.5, -25.1}):Play()
	
	wait(1.5)
	local merchantc	 = merchant:Clone()
	merchantc.Parent = workspace
	
	wait(1)
	ts:Create(merchantvfxc.Cylinder, TweenInfo.new(1, Enum.EasingStyle.Circular), {Size = 0.2, 0.2, 0.2}):Play()
	ts:Create(merchantvfxc.Cylinder, TweenInfo.new(1, Enum.EasingStyle.Circular), {Position = -33.1, 1027, -25.1}):Play()
	merchantvfxc:Destroy()
	
	wait(300)
	merchantc:Destroy()
end


while true do
		local random = math.random(0,100)
		if random <= 0.00009090909 then
			merchantspawn()	
		end
	wait(atick)
end

You can just ignore the rolling system there because its working properly. The problem here is at the merchantspawn() function. I don’t see any mistakes there but everytime i tested the game, it said “Unable to cast to Dictionary.” at line 10. Any idea on how to fix this?

You forgot to add the Vector3.new() in Size and Position, so it would be like sorta like this:

ts:Create(merchantvfxc.Cylinder, TweenInfo.new(1, Enum.EasingStyle.Circular), {Size = Vector3.new(0.2, 0.2, 0.2)}):Play()
1 Like

That should work, I tried it but now it says “attempt to call a table value”?

Edit: I forgot to put .new and now its working! looks like need just some sleep now

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.