Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my character fling when I look around in first-person with rigged arms?

Basically I'm creating an fps and I wanted to know why my character flings when I look around.

https://gyazo.com/cc6c2605d3379add8ca4e7e2216e6eab <GIF

Basically I have a custom rig with a humanoid, arms, torso and the gun, and I attach it to the camera. I thought maybe something can collide with my character and that would cause me to fling but of what I can see that's not the issue.

https://gyazo.com/1e7f4c25f3e14a224fb2101adde466e1 <PIC

Also I like how I do things as of now and that I only want to know why and how to fix the flinging, the rig with the gun in it is easy to animate and saves a lot of time where I would be doing trial and error to figure out where to put the hands and the gun.

Code and Resources Below

local Player = game.Players.LocalPlayer
local Char = script.Parent
local Camera = workspace.Camera
local Run = game:GetService("RunService")
local Body = game.ReplicatedFirst.CameraBody:Clone()
local Input = game:GetService("UserInputService")
--local Gun = game.ReplicatedFirst.Gun

Run.RenderStepped:Connect(function()
	Body.HumanoidRootPart.CFrame = Camera.CFrame
end)

Body.Parent = Camera
--Gun.Parent = Camera

IdleAnimation = Instance.new("Animation"); IdleAnimation.AnimationId = "rbxassetid://4597725243"; PlayIdle = Body.Humanoid:LoadAnimation(IdleAnimation)
ReloadAnimation = Instance.new("Animation"); ReloadAnimation.AnimationId = "rbxassetid://4598138817"; PlayReload = Body.Humanoid:LoadAnimation(ReloadAnimation)
FireAnimation = Instance.new("Animation"); FireAnimation.AnimationId = "rbxassetid://4598142234"; PlayFire = Body.Humanoid:LoadAnimation(FireAnimation)

PlayIdle:Play()
Input.InputEnded:Connect(function(inputObject, gameProcessedEvent)
	if gameProcessedEvent then return end
		if inputObject.UserInputType == Enum.UserInputType.Keyboard then
			if inputObject.KeyCode.Name == 'R' then
				PlayReload:Play()
			end
			if inputObject.KeyCode.Name == 'F' then
				PlayFire:Play()
			end
		end	
end)

https://gyazo.com/8d9d6db1389012bc98ce92e87e9bbaee <PIC

1 comment

0

Also the flinging is very random, its not rare but its hard to replicate, I luckily got it on my first try.

1 answer

✓ Accepted answer

I had this same problem for a while and recently found out how to fix it. Just put the view model into a collision group and it should be fixed. Make sure that the collision group does not collide with any other group.

1 comment

0

Thank you :)

This discussion is preserved as it was. New answers, comments, and votes are closed.