Hi, so i’m making a game but to reset your character you press P and you pull out a revolver.
I don’t know how to make the revolver actually appear, and i have tried making a motor6d then parenting it to the right arm.
Here is my code:
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Blood = require(ReplicatedStorage.Game.Modules.Blood)
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local conn
conn = UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return false end
if input.KeyCode == Enum.KeyCode.P then
local handle = Instance.new("Part")
handle.Name = "Handle"
handle.BrickColor = BrickColor.Black()
handle.CFrame = CFrame.new(-20.8724232, 1.9000001, -27.0597878) * CFrame.Angles(0, 180, 180)
handle.Color = Color3.fromRGB(27, 42, 53)
handle.Rotation = Vector3.new(-180, 0, 0)
handle.Size = Vector3.new(0.2, 1.4, 0.8)
local fireSound = Instance.new("Sound")
fireSound.Name = "FireSound"
fireSound.PlaybackSpeed = 0.87
fireSound.RollOffMinDistance = 0
fireSound.SoundId = "http://roblox.com/asset/?id=10209803"
fireSound.Volume = 1
fireSound.Parent = handle
local mesh = Instance.new("SpecialMesh")
mesh.Name = "Mesh"
mesh.MeshType = Enum.MeshType.FileMesh
mesh.MeshId = "http://www.roblox.com/asset/?id=79401392 "
mesh.TextureId = "http://www.roblox.com/asset/?id=91723031"
mesh.Scale = Vector3.new(1.5, 1.5, 1.5)
mesh.Parent = handle
local motor = Instance.new("Motor6D")
motor.Name = "Handle"
motor.Part0 = Character:WaitForChild("Right Arm")
motor.Part1 = handle
motor.C0 = CFrame.new(-0.272483826, -1.0999999, -0.459848404, 1, 0, 0, 0, -1, 0, 0, 0, -1)
motor.Parent = Character:WaitForChild("Right Arm")
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://14149994446"
local animationTrack = Humanoid:FindFirstChildWhichIsA("Animator"):LoadAnimation(animation)
animationTrack:Play()
animationTrack:GetMarkerReachedSignal("Spin"):Connect(function()
local spinSound = Instance.new("Sound")
spinSound.SoundId = "rbxassetid://14150186452"
spinSound.Parent = handle
spinSound:Play()
end)
conn:Disconnect()
end
end)
``` The revolver doesn't appear in the player's hands but the animation plays.
Please help me fix this.
help will be appreciated.