Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My script doesn't appear to be functioning?[SELF SOLVED]

So I am trying to make a script which gets a "node" or a green orb and goes to it. it gets them in order like this: node1, node2 etc. It then makes a tween to go to the position of the orb. But instead it doesn't do that or animate or anything, It just teleports off to the side of the track before My player can load. And if i add a wait(10) it doesn't work at all

Script:

local TweenService = game:GetService("TweenService")
local Parent = script.Parent
local count = 1
local TweenTable = {}

print("Wating!")
local Parts = game.Workspace:GetChildren()
for _,v in pairs(Parts) do
    print("checked:"..v.Name)
    if v.Name == "Node"..count then
        count = count + 1
        print(v.Name)
        local tweenInfo = TweenInfo.new(10)
        local goal = {}

        goal.Position = Vector3.new(v.Position.x, v.Position.y, v.Position.z)
        local tween = TweenService:Create(Parent, tweenInfo, goal)
        print("playing Tween!")
        tween:play()
    end
end


Picture

Picture

1 answer

Sorry I fixed it it had to do with the goal part Total Script:

local TweenService = game:GetService("TweenService")
local Parent = script.Parent
local count = 1
local TweenTable = {}

print("Wating!")
local Parts = game.Workspace:GetChildren()
for _,v in pairs(Parts) do
    print("checked:"..v.Name)
    if v.Name == "Node"..count then
        count = count + 1
        print(v.Name)
        local tweenInfo = TweenInfo.new(10)
        local goal = {}

        goal.Position = v.Position
        local tween = TweenService:Create(Parent, tweenInfo, goal)
	table.insert(TweenTable,count, tween)
    end
end
for _,k in pairs(TweenTable) do
	k:play()
	print("playing tween!")
	wait(10)

end

This discussion is preserved as it was. New answers, comments, and votes are closed.