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

I want a part(x) to appear in my hand when I play an animation?

Asked by 6 years ago
Edited 6 years ago

I want a part(x) to appear in my hand when I play an animation.Here is my code, thanks. Player = game.Players.LocalPlayer Mouse = Player:GetMouse() animation = script:WaitForChild("Animation")

Mouse.KeyDown:connect(function(key)
key = key:lower()
 if key == "q" then
    local animationTack = Player.Character.Humanoid:LoadAnimation(animation)
    animationTack:Play()
    wait(3.2)
    animationTack:Stop()
    wait(.3)
    local x = Instance.new("Part")
    x.Shape = "Ball"
    x.Material = "Neon"
    x.BrickColor = BrickColor.new("Bright red")
    x.TopSurface = "Smooth"
    x.BottomSurface = "Smooth"
    x.CanCollide = false
    x.Anchored = false
    x.CFrame = Player.Character.RightHand.CFrame * CFrame.new(0,0,-2)
    local v = Instance.new("BodyVelocity", x)
    v.velocity = Player.Character.Head.CFrame.lookVector * 90
    v.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  x.Parent = workspace
  wait(10)
    x:remove() 
      end

end)

0
Use a code block.. IfIWasntSoSwag 98 — 6y
0
i did DrDeath_GamingYT 2 — 6y
0
remove is depricated use Destroy saSlol2436 716 — 6y
0
connect and keyDown are also depricated saSlol2436 716 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Try creating a part called Handle and make you character equip it. You made a instance new right, but you should add a handle like x.Name = Handle local y = Instance.new("Tool") y.Name = AnimationTool y.Parent = game.Lighting and now the thing that will equip you the tool game.Players.LocalPlayer.Character.Humanoid:EquipTool(game.Lighting.AnimationTool) I dont know if this is right /\ I

Ad

Answer this question