CanCollide property activates randomly in ViewModel Function

Mine Tool ViewModel doesn’t work, also what is a ViewModel? You can search but it’s not quite needed since its just a Half of a Dummy to be displayed on a camera with any Tools that you want on it’s hand.

So the Can Collide Property keeps activating without any sort of explanation and really I don’t know what to do on this case.

Here is some of the Script that may help further into this and a Video:

local function WhenEquipped()

	Humanoid = character:WaitForChild("Humanoid")
	
	if Humanoid then
		
		if Humanoid.RigType == Enum.HumanoidRigType.R15 then
			Selec = "R6"
		elseif Humanoid.RigType == Enum.HumanoidRigType.R6 then
			Selec = "R6"
		end
		local Name = "ViewMdl" .. Selec
			local ViewModels = workspace.Camera:GetChildren()
			
			if ViewModels then
				for i, v in ipairs(ViewModels) do
					v:Destroy()
				end
			end
			
		ViewMdl = ReplicatedStorage:FindFirstChild(Name):Clone()
		
		ViewMdl.Parent = Camera
		
			RunService.RenderStepped:Connect(function()
			if Humanoid.Health == 0 then
				if Camera:FindFirstChild(Name) then
					Camera.Name:Destroy()
				end
			end
			
			if Camera:FindFirstChild(Name) ~= nil then
				Camera[Name]:SetPrimaryPartCFrame(Camera.CFrame * CFrame.new(.025, -2.5, -1) * CFrame.Angles(0.05, 0, 0))
			end
		end)
	end
end

Tool.Equipped:Connect(WhenEquipped)```

An Explanation Of the Video: When I Equip the tool, the tool Clones a ViewModel from the ReplicatedStorage and Parents it to the camera and as it tries, the can collide property somehow activates again.

[robloxapp-20210921-1149112.wmv|attachment](upload://rj1wD8weHYEcuykYip7QiQjNKLX.wmv) (2.5 MB)

In my opinion, almost everything but sure I did try and relook all the tutorials i got the information from and so On.

Thanks in advance if you help so!

Must be some other script causing this effect, go through your scripts and search for “CanCollide”.

The only one I found was from a Door Can Collide, also does having the Studio Bugged mean something really?

I’ve had the same problem with my ViewModel.

The best solution I’ve found is Collision Groups (here’s a article on Collision Filtering | Roblox Creator Documentation)

Note: changing the viewmodel collision group will make the model act like the Locked property is true

1 Like

Im still testing but yet im sure it will work

1 Like

ViewModel will always have collision parts as long as it has a humanoid I think
So your only solution is probably making a noncollidable collision group only for the viewmodel parts

1 Like