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

Is my calculation right because it's spinning instead of turning?

Asked by
Simnico99 206 Moderation Voter
5 years ago

What i did wrong? it is not turning the way i want it to it is using roblox PathService and getting the next path as the position Parameter:

Here what it does: https://gyazo.com/ecf8d529cefbadd34f47b3c10093bcbc

local function tweenModel(model, CF, info)
    local CFrameValue = Instance.new("CFrameValue")
    CFrameValue.Value = model:GetPrimaryPartCFrame()

    local goal = {}
    goal.Value = nil
    goal.Value = CF 

    CFrameValue:GetPropertyChangedSignal("Value"):connect(function()
        model:SetPrimaryPartCFrame(CFrameValue.Value)
    end)

    local tween = tweenService:Create(CFrameValue, info, goal)
    tween:Play()

    tween.Completed:connect(function()
        CFrameValue:Destroy()
    end)
end


function Rotate(Position)

local info =  TweenInfo.new(1)
tweenModel(ParentModel,CFrame.new(HumanoidRootPart.Position, ParentModel.AdorneeBox.CFrame:pointToWorldSpace(Position)),info)

end
0
You might be better off using the lerp function in CFrame instead of using the tween service User#5423 17 — 5y
0
Why? Simnico99 206 — 5y
0
It should give you better results that using changed events. User#5423 17 — 5y
0
In line 24 there are multiple properties. Why just put a 1? User#19524 175 — 5y
0
Because they arent all needed Simnico99 206 — 5y

Answer this question