I’m attempting to create a coin pusher machine, however, the physics prove to be kind of finicky as demonstrated with this clip:
https://gyazo.com/07c7f1fb6346c2fb60e745e1647c1fb8
The “pusher” is using a CFrame Tween to move, I believe this to be the issue as interactions between the other coins works without problem, but if a coin lands on the pusher as it’s moving, it seems to “freeze” it’s physics until left alone for a second.
This is the script that manages the pusher:
local tws = game:GetService("TweenService")
local part = script.Parent
local cf = script.Parent.CFrame
local AnimDuration = 5
local isActive = true
local paramsF =
{CFrame = cf * CFrame.new(0,0,10)}
local paramsB =
{CFrame = cf * CFrame.new(0,0,-10)}
local TweenF = tws:Create(script.Parent, TweenInfo.new(AnimDuration), paramsF)
local TweenB = tws:Create(script.Parent, TweenInfo.new(AnimDuration), paramsB)
while true do
if isActive then
cf = script.Parent.CFrame
paramsF =
{CFrame = cf * CFrame.new(0,0,10)}
TweenF = tws:Create(script.Parent, TweenInfo.new(AnimDuration), paramsF)
TweenF:Play()
wait(AnimDuration)
cf = script.Parent.CFrame
paramsB =
{CFrame = cf * CFrame.new(0,0,-10)}
TweenB = tws:Create(script.Parent, TweenInfo.new(AnimDuration), paramsB)
TweenB:Play()
wait(AnimDuration)
end
end
I am aware that the problem is due to the parts not waking up for physics calculation but I’ve got no idea on how to solve it.
Here’s a demonstration of the parts that are awake being highlighted.