I am making an obby stage where there are Rocks falling from the ceiling and you have to get through before it kills you when you touch the so called “Smash Part” of the rock
I welded the two part together with a weld constraint:
but the “SmashPart” is not anchored:
I am lerping the rocks to fall and rise again. I have selected Part1 and Part2 correctly:
and I believe I set up the SmashPart correctly (see the second screenshot). But instead they are floating in mid-air like in the build mode. My script to move the Stones is here:
local Library = require(game:GetService("ServerScriptService"):WaitForChild("Library"))
local Rocks = script.Parent:WaitForChild("Rocks"):GetChildren()
local moveDownDistance = 20
for _, Rock in ipairs(Rocks) do
local originalPosition = Rock.Position
local targetPosition = originalPosition - Vector3.new(0, moveDownDistance, 0)
local moveDownTime = 1.5
local riseTime = 2.3
task.spawn(function()
while true do
local startTime = tick()
while tick() - startTime < moveDownTime do
local elapsedTime = tick() - startTime
local lerpedPosition = originalPosition:Lerp(targetPosition, elapsedTime / moveDownTime)
Rock.Position = lerpedPosition
task.wait()
end
task.wait(2)
startTime = tick()
while tick() - startTime < riseTime do
local elapsedTime = tick() - startTime
local lerpedPosition = targetPosition:Lerp(originalPosition, elapsedTime / riseTime)
Rock.Position = lerpedPosition
task.wait()
end
task.wait(1)
end
end)
task.wait(1.5)
end
Doesn’t welding work for lerping?