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

2 comments

0

@Block_manvn the problem does seem to be due to sleeping parts, however I'm not quite sure on how to fix it, I've tried looking for the aforementioned option in beta features but it's not there.