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

How can I make fake arms that follow the mouse like in FPS?

Asked by
Hero_ic 502 Moderation Voter
9 years ago

I've been trying to create new arms and weld them to the old ones and make them go in a 90 degree angle to get them to look like how they do in FPS (Halo,Destiny,COD,etc)

I've been trying over and over to get this to work but nothing I did was right maybe one of you great people can help me with this?

2 answers

Log in to vote
0
Answered by 9 years ago

Please read the green text before downvoting.

Debounce = false
game.Workspace.ChildAdded:connect(function(Player)--Calls the function everytime a Character respawn or load
local Humanoid = Player:FindFirstChild("Humanoid")
if Humanoid then
if not Debounce then 
    Debounce = true

local ArmStorage = game.Workspace:FindFirstChild("ArmStorage")--Check if there is a Model In Workspace called ArmStorage
if not ArmStorage then--If the Model doesn't Exist then...
    local Model = Instance.new("Model", game.Workspace)--It creates a Model and Names it "ArmStorage"
        Model.Name = "ArmStorage"
end 
    wait(1)
print("Player Character Has Loaded")
    local FakeArmL = Player["Left Arm"]:Clone()--Clone the player's Arm
    FakeArmL.Name = "FakeArmL"--Name it
    FakeArmL.Parent = game.Workspace.ArmStorage--Sets the Clone Parent
    FakeArmL.CFrame = Player["Left Arm"].CFrame--CFrame the Clone Arm to the "Original Arm" position
    local Weld1 = Instance.new("Weld", FakeArmL)--Using a Instance to create a weld and Parenting it to the Clone
        Weld1.Part1 = Player["Left Arm"]--Part1 property of the weld is Attached to the "Original Arm"
        Weld1.Part0 = FakeArmL--Part0 property of the weld is Attached to the Clone
    Player["Left Arm"].Transparency = 1--Set the "Original Arm" Transparency to 1 so you can see the Clone Arm

--Creating the Right Arm(Exactly the Same as to top bit of coding but with different name)  
    local FakeArmR = Player["Right Arm"]:Clone()
    FakeArmR.Name = "FakeArmR"
    FakeArmR.Parent = game.Workspace.ArmStorage
    FakeArmR.CFrame = Player["Right Arm"].CFrame
    local Weld2 = Instance.new("Weld", FakeArmR)
        Weld2.Part1 = Player["Right Arm"]
        Weld2.Part0 = FakeArmR
    Player["Right Arm"].Transparency = 1
Debounce = false
end end end)

1
You do not have an explanation PLUS you cannot post the full script on the site. Read the rule book. EzraNehemiah_TF2 3552 — 9y
0
Its fine he did have an explanation! Hero_ic 502 — 9y
0
I have explained it if you can't see the green comment I made. Also there nowhere in the rule book where it says your not allowed to give "full script" while explaining it! UserOnly20Characters 890 — 9y
Ad
Log in to vote
2
Answered by 9 years ago

I got this working by parenting the cloned arms to the Camera. I also had to clone the Humanoid and Shirt from the character for the character's appearance to apply to the new arms.

You can see the arms when you look down or jump.

LocalScript in StarterGui:

local Player = game.Players.LocalPlayer
local Char = Player.Character
local Cam = workspace.CurrentCamera

local Left = Char:WaitForChild("Left Arm")
local Right = Char:WaitForChild("Right Arm")

local FakeL = Left:Clone() --Create Fake arms
local FakeR = Right:Clone()

local RightW = Instance.new("Weld",Right) --Weld arms together
local LeftW = Instance.new("Weld",Left)
RightW.Part0 = Right
RightW.Part1 = FakeR
LeftW.Part0 = Left
LeftW.Part1 = FakeL

local m = Instance.new("Model",Cam) --Create a model for the fake character
m.Name = "Fake Character"

Char:WaitForChild("Shirt"):Clone().Parent = m --Cloning for character appearance
Char:WaitForChild("Humanoid"):Clone().Parent =m

FakeL.Parent = m --Parent the fake arms to the fake character
FakeR.Parent = m
0
Line 11,12 are pointless since the clone arm will have the same properties as the Original. UserOnly20Characters 890 — 9y

Answer this question