while wait(10) do
local tweenService = game:GetService("TweenService")
for i,v in pairs(game.Workspace.InGameObby:GetChildren()) do
for x,y in pairs(v:GetChildren()) do
for a,b in pairs(y:GetChildren()) do
if b.Name == "Upward" then
print(b.Name)
local position = b.Position
local tweeningInfo = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
-1,
true,
1
)
local goals = {
Position = position + Vector3.new(0,10,0);
}
local Tween = tweenService:Create(b,tweeningInfo,goals)
Tween:Play()
end
end
end
end
end
I have this script that checks if a part is named upward and if it is then it would tween it upwards but i get an error in output i wonder why
21:26:52.096 - Unable to cast to Dictionary
21:26:52.097 - Stack Begin
21:26:52.098 - Script 'Players.sktvladimir535.PlayerScripts.LocalScript', Line 21
21:26:52.100 - Stack End
You forgot to specify in the goals table that it needs to tween the Position property.
local TweenService = game:GetService("TweenService")
while wait(10) do
for i,v in pairs(game.Workspace.InGameObby:GetChildren()) do
for x,y in pairs(v:GetChildren()) do
for a,b in pairs(y:GetChildren()) do
if b.Name == "Upward" then
print(b.Name)
local position = b.Position
local tweeningInfo = TweenInfo.new(
5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
-1,
true,
1
)
local goals = {
Position = position + Vector3.new(0,10,0);
}
local Tween = TweenService:Create(b,tweeningInfo,goals)
Tween:Play()
end
end
end
end
end
In this code goals is an array with a Vector3 value inside it. What the tweenService needs is a dictionary with the property names as keys and the property values as value
Try replacing it with
local goals = {
Position = position + Vector3.new(0,10,0);
}