I am trying to make a wander script that randomly picks orientations and distance to walk, and i am using the tweenservice to make it look smooth. For some reason all the parts the script is in keeps flying back to 0,0,0. Here is my script:
while true do
wait(math.random(1,10))
--turn
local tweenService = game:GetService("TweenService")
local part = script.Parent
local tweeningInformation = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partProperties = {
Orientation = script.Parent.Orientation + Vector3.new(0,math.random(1,180),0)
}
local Tween = tweenService:Create(part,tweeningInformation,partProperties)
Tween:Play()
wait(1.5)
--move
local tweeningInformation2 = TweenInfo.new(
1.5,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
0,
false,
0
)
local partProperties2 = {
Position = script.Parent.CFrame.lookVector * math.random(5,50)
}
local Tween = tweenService:Create(part,tweeningInformation2,partProperties2)
Tween:Play()
wait(1.5)
end
Any help????
P.S. the part i am trying to tween is a union

2 comments
God dude, please indent that.
I don't see what the problem is... I put the script into a simple union and tested it, and it worked just fine. It might not work if it's in a complicated union or if the union is anchored.