For some reason I have this parented to a part, and when I play the tween it does everything correctly except it moves the part to zero. I have tried putting positions inside the property table, but it still starts at 0,10,0 .Can anybody tell me why this is happening?
local TweenService = game:GetService("TweenService")
local part = script.Parent
part.Position = Vector3.new(0, 10, 0)
part.Anchored = true
part.Parent = game.Workspace
local function CreateAnimation(part,duration,easingstyle,easingdirection,repeatcount,reversing,delaybetweenpoints,property)
local tweenInfo = TweenInfo.new(
duration, -- Time
easingstyle, -- EasingStyle
easingdirection, -- EasingDirection
repeatcount, -- RepeatCount (when less than zero the tween will loop indefinitely)
reversing, -- Reverses (tween will reverse once reaching it's goal)
delaybetweenpoints -- DelayTime
)
local tween = TweenService:Create(part, tweenInfo, property)
return tween
end
local animation = CreateAnimation(script.Parent,10,Enum.EasingStyle.Back,Enum.EasingDirection.Out,10,true,0.5,{Position = Vector3.new(5,5,5)})
script.Parent.Position = script.Parent.Position
animation:Play()