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

TweenService and Models and LookVector ?

Asked by 3 years ago
    local FireBall = Meshes:WaitForChild("FireBall"):Clone()
    local RootP = FireBall.Root
    FireBall.PrimaryPart = RootP
    RootP.CFrame = Humrp.CFrame * CFrame.new(0,0,-4)
    FireBall.Parent = clonedMeshes

    local FFireI = TweenInfo.new(0.5)

    local FFireT = TweenService:Create(RootP, FFireI, {CFrame = mousehit})

    FFireT:Play()

So I wrote this code with the help of this post https://devforum.roblox.com/t/introduction-to-tweening-models/315253 because tweening models were kinda confusing for me.

What I want to achieve is that when I press "F" I want the model (so I have to tween the root) to go towards "HumanoidRootPart.CFrame.LookVector" but when I insert it into the table of Tween I get this error

" TweenService:Create property named 'CFrame' cannot be tweened due to type mismatch (property is a 'CoordinateFrame', but given type is 'Vector3')"

so I replaced it for now with mouse.hit (sent from a local script to server script that's why its called mousehit) and works as expected.

So how can I do the LookVector part?

0
I honestly am confused ifreakinlostmyacount 52 — 3y
0
I honestly am confused on what is happening, so I'll just give you a line of code I made ans hope that helps Object:SetPrimaryPartCFrame(CFrame.new(Yes.Position + (Yes.CFrame.lookVector * 2.5))) ifreakinlostmyacount 52 — 3y
0
LookVector is a Vector3 value. Instead of {CFrame = HumanoidRootPart.CFrame.LookVector}, try {CFrame = CFrame.new(0, 0, 5) * CFrame.Angles(math.rad(HumanoidRootPart.CFrame.LookVector))}. CFrame.new(0, 0, 5) means that the part will be positioned 5 studs forward from the LookVector. AntiWorldliness 868 — 3y

Answer this question