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

how do I make dummies collisions off?

I'm trying to make the dummies collisions off but this script won't work. I modified a player collision script. The only error I got is - connect is not a valid member of Model

script

local ps= game:GetService("PhysicsService")
ps:CollisionGroupSetCollidable("p","p",false)

function NoCollide(model)
	for k,v in pairs(model:GetChildren()) do
		if v:IsA"BasePart" then
			PhysService:SetPartCollisionGroup(v,"p")
		end
	end
end

workspace:WaitForChild("Dummy"):connect(function(Dummy)
	Dummy.CharacterAdded:connect(function(char)
		char:WaitForChild("HumanoidRootPart")
		char:WaitForChild("Head")
		char:WaitForChild("Humanoid")
		wait(0.1)
		NoCollide(char)
	end)
	
	if Dummy.Character then
		NoCollide(Dummy.Character)
	end
end)

1 comment

2

Connect is a method/function for things like a character model etc, since the dummy is not a character the :Connect function shouldn't be there!

1 answer

✓ Accepted answer

WaitForChild() does not invoke a script signal, therefore Connect() should not be there.

It should be rather easy to just check for the child as a conditional statement, yes?

if workspace:WaitForChild("Dummy") then
	-- other code
end

Not sure why you'd want to use a function exclusive to RBXScriptSignals. That is unless you would want to use something like ChildAdded or ChildRemoved.

Judging by your code I can see that you want to set the Dummy so that it cannot collide with other players. Ok, here's something you should know:

  1. CharacterAdded is exclusive to players. It does not work on generic rigs. If you want to find when a rig is spawned, use ChildAdded.
  2. You can do all of this without needing an external function. This shouldn't even take 5-6 lines of code.

Hopefully this clears up your mistakes.

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