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

How do i add collision to a model which the player is controlling?

while wait() do
local w = UserInputService:IsKeyDown(Enum.KeyCode.W)

if w then 
	print("W was held down")
	 model = game.Workspace.Model
model.PrimaryPart.CFrame = CFrame.new(model.PrimaryPart.Position + Vector3.new(0,0,-2))


	
	
	
else
	
	print("W was not")
	
end

	local model = game.Workspace.Model
	model.PrimaryPart.CFrame = CFrame.new(model.PrimaryPart.Position)
end 

The script works fine, but the model doesn't seem to collide with anything.

I turned CanCollide to true in everything in the model.

1 answer

Have to tried to set each part of the model to can collide through the script?

For Example:

--replace "part" with the name of the block of you named it 
part.CanCollide = true -- do it for each part

Try to change the name of the part to different names to make sure it works

Good Luck!

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