I’ve been experimenting with viewmodels lately, and it appears that whenever i do anything (like turning all parts no collide, moving clone parent, changing collision ids, etc) i can’t fix the viewmodel’s collision.
One that worked was that I renamed the left arm and the right arm, yet it breaks the humanoid and animation. If I try to turn off the collision myself, it turns back on.
Ah yes, the problem I had until I got fixed a few months ago. What I would do is getting the physics service and add collision groups.
Script in ServerScriptService:
local PhysicsService = game:GetService("PhysicsService")
pcall(function()
PhysicsService:CreateCollisionGroup("NameOfYourViewmodel")
PhysicsService:CollisionGroupSetCollidable("ModelName", "Default", false)
end)
In the local script, I would set the collision group to make it uncollidable.
local PhysicsService = game:GetService("PhysicsService")
local function SetCollsionGroup(Children, Group)
for Index = 1, #Children do
if (Children[Index]:IsA("BasePart")) then
PhysicsService:SetPartCollisionGroup(Children[Index], Group)
end
SetCollsionGroup(Children[Index]:GetChildren(), Group)
end
end
SetCollsionGroup(viewmodel:GetChildren(), "NameOfYourViewmodel") -- the viewmodel is a model
Note:
The name “NameOfYourViewmodel” is a collision group. It must has the same name otherwise it won’t work.
The name “viewmodel” is your Viewmodel Model.
The name “ModelName” is the name of your viewmodel