The title is what I want. It needs to copy meshes, layered clothing and normal clothing over from the character, which I have failed at making in all my past attempts.
In addition, nearly every time I have attempted to add arms to a viewmodel, they have had collision despite me setting the CanCollide property to false.
I already know how to make a viewmodel, I have done viewmodels many times.
I just need to know the best way to use the characters arms as the arms on the model, so I can animate everything properly.
Edit: I attempted to use the actual arms by changing the transparency, but I ran into several issues with this, primarily getting the camera in a good position and then having it not clip through walls.
My attempted solution to not having the camera clip through walls was to have the Z camera offset to be around 0.75 normally, but raycast forward to set it back if it needed to be set back. This however, just caused the camera offset to immediately snap to -1 for whatever reason.
the collision is essentially just because you’re using a humanoid and that’s a “funny humanoid quirk”
I would suggest (if the only problem with the cloned viewmodel was goofy humanoid) putting your vm on another physics group that can’t collide with anything
Then probably just copy the transforms of each arm joint every frame and boom viewmodel
PhysicsService:RegisterCollisionGroup("Viewmodels")
PhysicsService:CollisionGroupSetCollidable("Viewmodels", "Viewmodels", false)
for i, object in pairs(game.ReplicatedStorage.Camera:GetChildren()) do
if object:IsA("BasePart") then
object.CollisionGroupId = "Viewmodels"
end
end
print('Set viewmodel Collision')
Client:
local Viewmodel = ReplicatedStorage:WaitForChild('Camera')
print('Got viewmodel')
Viewmodel.Parent = Camera
-- Cloning shirts over, still need layered clothing and arm meshes and idk how to do that
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Shirt") then
local c = v:Clone()
c.Parent = Viewmodel
end
end
You set the object’s CollisionGroupId on line 6 of your code. Make you you are using CollisionGroup instead, as that takes in the Collision Group Name.
Just changed it, same problem.
I dont know why this isnt working, its the exact same code I’m using to make the players not collide with eachother.
Hell, I’ve even tried setting the collision group through the client too, still the same problem.
-- client
local Viewmodel = ReplicatedStorage:WaitForChild('Camera'):Clone()
for i, object in pairs(Viewmodel:GetChildren()) do
if object:IsA("BasePart") then
object.CollisionGroup = "Viewmodels"
end
end
-- server
PhysicsService:RegisterCollisionGroup("Viewmodels")
PhysicsService:CollisionGroupSetCollidable("Viewmodels", "Viewmodels", false)
for i, object in pairs(game.ReplicatedStorage.Camera:GetChildren()) do
if object:IsA("BasePart") then
object.CollisionGroup = "Viewmodels"
end
end
Everything on the model still collides with the player despite having the collision group set
Also, in a previous attempt I have tried this and had the same problem, to try and fix it I made a function to set the cancollide property of all parts to false and bound it to framerate, and that didnt even work.
Update on this: Just remembered that when renaming stuff like this, the shirt textures dont apply.
So it isnt a solution, as i want the shirt to be used as well as layered clothing, which i still dont know how to do.