So I made this script to tween parts to move on the X and Z but I cant seem to be able to script the script so that it works with gravity that the part still moves but still has downwards gravity.

-- Services
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService('ReplicatedStorage')

local Parts = game.Workspace.Parts
local MovePart = Parts.Move
local partBabys = Parts:GetChildren()
local point = ReplicatedStorage:WaitForChild("Point").Value

for i,v in ipairs(partBabys) do
    if v:IsA('Model') then
        local MoveProperties = {
            Position = Vector3.new(point, v.PrimaryPart.Position.X, v.PrimaryPart.Position.Y, v.PrimaryPart.Position.Z)
        }

        local MoveInfo = TweenInfo.new(17, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, false, 0)

        local MoveTween = TweenService:Create(v.PrimaryPart, MoveInfo, MoveProperties)

        MoveTween:Play()
    end
    if v:IsA('Part') then
        local MoveProperties = {
            Position = Vector3.new(point, v.Position.Y, v.Position.Z)
        }

        local MoveInfo = TweenInfo.new(17, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, -1, false, 0)

        local MoveTween = TweenService:Create(v, MoveInfo, MoveProperties)

        MoveTween:Play()
    end
end

1 comment

0

line 10 not ipairs but in pairs