I made an obby stage where there are falling stones and the player has to get through them before they fall on the ground again. But if they get hit from the bottom face of the rock, they will die. If I would use a touch event on the stone, the player would also die if they touched it from the side. So I added a really thin part on the bottom face and if they touch that they will die. The only problem is, that the thin part doesn't move with the big rock. Notice that both my big rock and my thin part are anchored
This is normal This is when the part is moving in-game
I've tried using WeldConstraints, Welds, Motor6Ds, Attachments etc. But nothing really worked. Am I too dumb or should I do something completely different?
Or should I just use a model?
Darrian wanted to see my code so here it is (I'm using TweenService):
coroutine.resume(coroutine.create(function()
while true do
task.wait(math.random(0.4,0.6))
local FallTween = TweenService:Create(
Stone,
TweenInfo.new(1.5, Enum.EasingStyle.Quint, Enum.EasingDirection.In, 0, false),
{
['Position'] = Vector3.new(Stone.Position.X, Stone.Position.Y - moveDistance, Stone.Position.Z)
}
)
FallTween:Play()
FallTween.Completed:Wait()
task.wait(1)
local GoUpTween = TweenService:Create(
Stone,
TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false),
{
['Position'] = Vector3.new(Stone.Position.X, Stone.Position.Y + moveDistance, Stone.Position.Z)
}
)
GoUpTween:Play()
GoUpTween.Completed:Wait()
end
end))
(By the way for these people who say I shouldn't use links for images, Stack Overflow doesn't allow me to embed images)
You can tween parts that have welds and other physics parts however as Tween Service isn't a physics based translation the connected parts will not move with it.
I found a forum post on the DevForum explaining this with their solution. https://devforum.roblox.com/t/tweening-welded-objects/323897
Personally I would edit my code to tween both parts simultaneously. To do this I would work out the distance the Tween travels and apply the same tween to both parts within the same script.
Because the TweenService
is not physics based and should be used more as a animation based movement for purely visual purposes I wouldn't recommend using tweening for this obby obstacle as the touch event might not work as intended when the tween animation plays.
Alternatively you could use a RodConstraint
as a sort of piston where you have a script that changes the length at which it is extended. This would mean you could simply weld the other part and not have the same problem