Unable to cast to Dictionary

So im currently working on a script for my game, but im very new into making visual effects for my game. Can someone help out? I got an error and I dont know how can I fix this.

local TweenService = game:GetService("TweenService")
local Rep = game:GetService("ReplicatedStorage")
local remote = Rep.AttackIncrease

--variables
local debounce = false
local Enabled = false


--config
local Tweening = {
	['Transparency'] = 0.15;
	['Size'] = Vector3.new(14, 2, 14);
}



local tweenInfo = TweenInfo.new(
	2.5, --change the duration 
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out, 
	0,
	false, --reverse
	0
)

--Code
local function Animation(plr)
	repeat
		local char = plr.Character

		local AnimVfx = Rep.vfx.Incres:Clone()
		AnimVfx.Parent = char
		AnimVfx.Position = char.Torso.Position - Vector3.new(0,3,0)
		AnimVfx.Weld.Part1 = char.Torso
		local Particle = Rep.Particle.ParticleEmitter:Clone()
		Particle.Parent = char.Torso
		wait()
		local TweenName = TweenService:Create(AnimVfx, tweenInfo, Tweening.Transparency)
		local twen = TweenService:Create(AnimVfx, tweenInfo, Tweening.Size)
		TweenName:Play()
		twen:Play()
		wait(2.6)
		AnimVfx:Destroy()
		Particle:Destroy()
		wait(2.5)
	until Enabled == false
	
end

remote.OnServerEvent:Connect(Animation)

Huge thanks to you guys who can reply or send feedback to me, I will give everyone a heart if you leave a reply!

3 Likes

You need to pass the dictionary directly, you don’t have to pass every property separately:

local function Animation(plr)
	repeat
		local char = plr.Character

		local AnimVfx = Rep.vfx.Incres:Clone()
		AnimVfx.Parent = char
		AnimVfx.Position = char.Torso.Position - Vector3.new(0,3,0)
		AnimVfx.Weld.Part1 = char.Torso
		local Particle = Rep.Particle.ParticleEmitter:Clone()
		Particle.Parent = char.Torso
		wait()
		local TweenName = TweenService:Create(AnimVfx, tweenInfo, Tweening) --Here, your 3rd argument is the Tweening dictionary that defines the goal of the tween animation on specified properties for the AnimVfx object.
		TweenName:Play()
		wait(2.6)
		AnimVfx:Destroy()
		Particle:Destroy()
		wait(2.5)
	until Enabled == false
	
end
5 Likes

it works! Thanks for helping! You deserve a free heart!

1 Like

You could also mark his answer as a solution if it works :wink:

1 Like