I’ve got these guns I’m messing around with. I’m trying to get the gun which is attached to my arm so essentially my arm to rotate and follow my mouse wherever it goes. To simulate aiming around the screen with a gun
You do not really seem to be asking a question here, but based on the title of your post, I assume you want the arms to show in first person mode. To achieve this, I suggest changing the left and right arm’s LocalTransparencyModifier property. This is handled through a LocalScript on the client. You can find more information about this here:
As for animating the gun (allowing it to rotate based on the camera’s orientation), this is a much more complex concept. You will have to do a lot of research for this, but I suggest you use the following DevForum post as a guide. I personally used this one when I was researching this topic myself and can assure you it is very helpful.
I know that you know that there is much more to local animation than that one line of code. This is not helpful to him if he truly wants to understand this complex topic.
Mouse = game.Players.LocalPlayer:GetMouse()
Character = game.Players.LocalPlayer:WaitForChild("Character")
while true do
wait()
Character.RightUpperArm.CFrame = CFrame.new(Character.RightUpperArm.Position, Mouse.hit.p)
end
So this just yeets my character, is there a better way to go about this? I’ve got my “fake arms” welded to upper arms.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
Mouse = game.Players.LocalPlayer:GetMouse()
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
while true do
wait()
character.RightUpperArm.CFrame = CFrame.new(character.RightUpperArm.Position, Mouse.hit.p)
end
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
Mouse = game.Players.LocalPlayer:GetMouse()
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
while true do
wait()
character.RightUpperArm.CanCollide = false
character.LeftUpperArm.CanCollide = false
character.LeftLowerArm.CanCollide = false
character.RightLowerArm.CanCollide = false
character.LeftHand.CanCollide = false
character.RightHand.CanCollide = false
character.RightUpperArm.CFrame = CFrame.new(character.RightUpperArm.Position, Mouse.hit.p)
end
https://gyazo.com/3ae2674ae5c02b5760dcbe3aca61d382
I added a collision group called “Arms”
I unchecked “default” I assume that turns off collision for all other objects? So it wont collide with anything?
Not having any such luck though sadly. Still same issue.
So I put this script in my starter character scripts.
local PhysicsService = game:GetService("PhysicsService")
local arms = "Arms"
character = script.Parent
PhysicsService:SetPartCollisionGroup(character.LeftUpperArm, arms)
PhysicsService:SetPartCollisionGroup(character.LeftLowerArm, arms)
PhysicsService:SetPartCollisionGroup(character.LeftHand, arms)
PhysicsService:SetPartCollisionGroup(character.RightUpperArm, arms)
PhysicsService:SetPartCollisionGroup(character.RightHand, arms)
PhysicsService:SetPartCollisionGroup(character.RightLowerArm, arms)
My arm CFrame script (Inside LocalScript)
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
Mouse = game.Players.LocalPlayer:GetMouse()
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end
while true do
wait()
character.RightUpperArm.CFrame = CFrame.new(character.RightUpperArm.Position, Mouse.hit.p)
end