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

How do you make model rotating where you look? [closed]

Asked by
Sougood -10
5 years ago

Hello. So, I am making game, where will be pets, but. The pet is model, with PrimaryPart, not a mesh. So I don't know how to make it rotate depending on where you look.

I have made this, but it only rotates in half and then goes back.

local Pet = script.Parent
local Move = script.Parent:WaitForChild('Move')

Move.OnServerEvent:connect(function(Player)
    if workspace[Player.Name] then
        local Head = workspace[Player.Name]:FindFirstChild('Head')
        if Head then
            Pet:SetPrimaryPartCFrame(CFrame.new(Head.CFrame.X + 1,Head.CFrame.Y +                                           2,Head.CFrame.Z + 1))
            Pet:SetPrimaryPartCFrame(Pet.Hitbox.CFrame * CFrame.Angles(0,Head.CFrame.lookVector.Z,0))
        end
    end
end)

0
Your question is a duplicate of this one: https://scriptinghelpers.org/questions/61942/model-rotating-where-you-look-help which you posted 2 hours ago and edited right before you posted this one. Because you know how to edit, you should definitely not of posted a duplicate question. This is strongly discouraged. Please read the following help article so that you can post better quality questions. amanda 1059 — 5y

Marked as Duplicate by amanda and KingLoneCat

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?