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

How can I fix the hand always moving In the same direction and not moving where player Is facing?

Asked by 1 year ago

(Please respond)

Hello developers!

I made a tool Inside of a NPC that summons a hand that currently only moves, the problem Is that I am trying to get the hand to move where the player Is facing, just Its moving In the same direction, also, the reason why I rotated the part Is because If I didn't add Hand.Rotation = Vector3.new(0,0,-180) code It would cause the hand to go upside down which I don't need

Script:

local Tool = script.Parent
local Troll = Tool.Parent
local SANS = Troll.SANS
local Debounce = false

Tool.Activated:Connect(function(player,mousePos)
    if not Debounce then
        Debounce = true
        Troll.HumanoidRootPart.Anchored = true
        local SANSAnimation = Troll.Humanoid:FindFirstChild("Animator"):LoadAnimation(SANS)
        SANSAnimation:Play()
        wait(0.30)
        local Hand = Instance.new("Part",game.Workspace)
        local Mesh = Instance.new("SpecialMesh",Hand)
        Hand.Position = Troll.Torso.Position
        Hand.Orientation = Troll.Torso.Orientation
        Hand.Size = Vector3.new(4, 4, 2)
        Hand.Anchored = true
        Hand.CanCollide = false
        Hand.CastShadow = false
        Mesh.MeshId = "http://www.roblox.com/asset/?id=32054761"
        for i=0, 20 do
            Hand.Rotation = Vector3.new(0,0,-180)
            Hand.CFrame = Hand.CFrame + (Hand.CFrame.LookVector*1)
            wait()
        end
        game:GetService("Debris"):AddItem(Hand,0)
        wait(2)
        Troll.HumanoidRootPart.Anchored = false
        Debounce = false
    end
end)
0
Try multiplying your CFrame using CFrame.Angles instead of rotation. T3_MasterGamer 2189 — 1y

Answer this question