I am creating a sine wave but instead of parts re positioning as an individual it is re positioning as a croup.
Code:
local RunService = game:GetService("RunService")
local A = 1
local lambda = 1
local k = 2 * math.pi / lambda
local f = 1
local w = 2 * math.pi * f
local p = math.rad(0)
local D = 0
local y = function(x, t)
return A * math.sin(k * x + w * t + p) + D
end
local Parts = {}
local Size = Vector2.new(25, 25)
for X = 1, Size.X do
for Y = 1, Size.Y do
local Part = Instance.new("Part")
Part.CFrame = CFrame.new(X * 4, y(X * 4, tick()), Y * 4)
Part.Anchored = true
Part.Size = Vector3.new(4, 4, 4)
Part.Parent = workspace
table.insert(Parts, {
Part = Part,
CFrame = Part.CFrame
})
end
end
while true do
for _, Value in pairs(Parts) do
Value.Part.CFrame = CFrame.new(Value.CFrame.Position.X, y(Value.CFrame.Position.X, tick()), Value.CFrame.Position.Z)
end
wait()
end
what I mean is happening
robloxapp-20210531-1906381.wmv (153.8 KB)