Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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)
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) Perci1 4988 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

0
thanks! Reziztor 4 — 6y
Ad

Answer this question