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

How to make a part move by itself with out moving the model (with out anchoring the model)?

Asked by 6 years ago

I have this code that makes the head look where the mouse has clicked, but since it cant be anchored (because this is a model that is going to walk around freely). the head just sorta moves away. how do i connect it to the model? (ive tried attachments, hinges, welding,bodyposition and nothing)

local looker = game.Workspace.Gon.cun

local plr = game.Players.LocalPlayer
Mouse = plr:GetMouse()

local Prev_mousehit

local debounce = false

Mouse.Button1Up:connect(function()
    debounce = false
end)
Mouse.Button1Down:connect(function()
    debounce = true
end)

Mouse.Move:connect(function()
    if (debounce == true) then
        if Mouse.hit.p ~= Prev_mousehit then

            looker.CFrame= CFrame.new(looker.Position, Vector3.new(Mouse.hit.p.X,Mouse.hit.p.Y,Mouse.hit.p.Z))
            Prev_mousehit= Mouse.hit.p

        end
    end


    end)

Answer this question