Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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!

Ad

Answer this question