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

How can I make the part move where the player Is facing?

Asked by 2 years ago

Hello Developers!

I made a tool Inside of an NPC (Or Morph) that when activated summons a hand that currently does nothing besides moving but soon will grab on a victim they touched and smash them Into the ground, Currently, I rotated the hand so that way the hand Is not upside down, however It will move In the same direction and not where the player Is facing

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
        Hand.Rotation = Vector3.new(0,0,-180)
        Mesh.MeshId = "http://www.roblox.com/asset/?id=32054761"
        for i=0, 20 do
            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)

Answer this question