I don’t want to do this because when you get v.Size, it stays locked at that size which I don’t want, since i should repeatedly be changing the size
this is the current script
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {
v.Size.Z == Vector3.FromAxis(Enum.Axis.Z,800)
}
goal.CFrame = v.CFrame * CFrame.new(0,0,-400)
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal)
tween:Play()
end
end
end
but the problem with this is that i get:
Unable to cast to dictionary
It give the effect of moving forward
this was the old script
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {}
goal.Size = v.Size + Vector3.new(0,0,800)
goal.CFrame = v.CFrame * CFrame.new(0,0,-400)
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal)
tween:Play()
end
end
end
this resulted in
but I want the beam to constantly get bigger then smaller using a spawn function, which is why I only want to tween the z axis
The only error i’m getting using this script is : ‘Unable to Cast to Dictionary’
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {
v.Size.Z == Vector3.FromAxis(Enum.Axis.Z,800) ,
v.CFrame == v.CFrame * CFrame.new(0,0,-400)
}
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal)
tween:Play()
end
end
end
Oh I know the problem, you don’t need to say v.Size inside of the goal. Instead, just say the Size and CFrame part. Try this:
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {
Size.Z == Vector3.FromAxis(Enum.Axis.Z,800) ,
CFrame == v.CFrame * CFrame.new(0,0,-400)
}
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal) --the first parameter is v so you don't include that in the goal.
tween:Play()
end
end
end
you have to have on = in the goal table and you can’t set a X, Y or Z value, because they are read only.
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {
v.Size = Vector3.new(v.Size.X, v.Size.Y, 800)
}
goal.CFrame = v.CFrame * CFrame.new(0,0,-400)
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal)
tween:Play()
end
end
end
Size.Z is a locked datatype that can’t be tweened. Vector3 already has a Z parameter, so you can try tweening the size to a new Vector3 with a smaller/larger Z parameter.
for i, v in pairs(Folder:GetChildren()) do
if v.Name == "Source" == false then
if v.Name ~= "Inner" and v.Name ~= "Outter" and v.Name ~= "Wave" and v.Name ~= "Wave2" then
local goal = {
v.Size = Vector3.new(v.Size.X, v.Size.Y, 800)
}
goal.CFrame = v.CFrame * CFrame.new(0,0,-400)
local info = TweenInfo.new(6)
local tween = TweenService:Create(v,info,goal)
tween:Play()
end
end
end
And don’t worry about the size changing when it’s facing a another direction. A part’s size is only local to the part itself.