I’ve been trying for along time just to make some FPS arms that I can weld to a weapon. Heres some scripts I’ve used:
Script 1:
-- Variables
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local runService = game:GetService("RunService")
local viewModel = game.ReplicatedStorage.viewModel:Clone()
local viewModelRoot = viewModel.PrimaryPart
viewModel.Parent = workspace
-- RenderStepped
runService.RenderStepped:Connect(function ()
viewModelRoot.CFrame = workspace.CurrentCamera.CFrame * CFrame.new(0, -2, 0)
viewModel.Torso["Left Shoulder"].Transform = character.Torso["Left Shoulder"].Transform
viewModel.Torso["Right Shoulder"].Transform = character.Torso["Right Shoulder"].Transform
end)
Script 1 isnt working because:
This is how I want it to be:
But when I insert the motor6ds to connect the arms to the torso, this happens:
And when ever i try to move the arms back the motor6ds destroy
viewModel:
Script 2:
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local camera = workspace.Camera
local currentCamera = workspace.CurrentCamera
local viewModel = replicatedStorage:WaitForChild("viewModel"):Clone()
local humanoid = viewModel:FindFirstChild("Humanoid")
local motorCheck = script:WaitForChild("MotorCheck").Value
local motor6D = viewModel:FindFirstChild("Motor6DRight")
userInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.E then
runService.RenderStepped:Connect(function()
viewModel:SetPrimaryPartCFrame(currentCamera.CFrame * CFrame.new(0, -1, 0))
end)
viewModel.Parent = camera
motor6D.C0 = viewModel:WaitForChild("Right Arm").CFrame
motor6D.C1 = viewModel:WaitForChild("Handle").CFrame
motor6D.Part0 = viewModel:WaitForChild("Right Arm")
motor6D.Part1 = viewModel:WaitForChild("Handle")
if motorCheck == true then
motor6D.Part0 = viewModel:WaitForChild("Right Arm")
motor6D.Part1 = viewModel:WaitForChild("Handle")
end
local animationId = 6239823515
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID="..animationId
local loadAnimation = humanoid:LoadAnimation(animation)
loadAnimation:Play()
end
end)
When I load in with this script, the arms just fall through the world.
Heres what the 2nd viewportModel looks like
Any help is appreciated. Is there a better way I can do this?