Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

CFraming this brick to another object moves it to a completely different location?

I have a script that is supposed to tween the red brick to the blue brick when touched. However, when I touch the brick, this happens. any help?

function onTouched()
	local TweenService = game:GetService("TweenService")
	local Part = script.Parent
	local info = TweenInfo.new(
		2,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.Out,
		0,
		false,
		0
	)
	
	local Goals = 
	{
		CFrame = Part.CFrame * CFrame.new(-126.33, 0.025, 125.99)
	}
		
	local Tween = TweenService:Create(Part,info,Goals)
	Tween:Play()
end

script.Parent.Touched:connect(onTouched)

1 comment

0

It looks like you're just giving it the wrong goal. Try setting the goal CFrame to the blue part's CFrame (because the blue part is the goal)

1 answer

✓ Accepted answer

Youre issue is that on line 15 you multiply the CFrame of Part with the other CFrame.

I believe that changing line 15 to

CFrame = CFrame.new(-126.33, 0.025, 125.99)

would fix it.

1 comment

0

thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.