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

killing a zombie make a part uncollidable?

hello, i am new scripter trying to make it to where when you kill a zombie, a part in the workspace has can collide on false, so you can walk through that part. so far, nothing i have tried works. there is a lot of problems with my current script but here it is

function onDeath(Humanoid)
	game.Workspace.WALL.CanCollide = false
end
   script.Parent.Humanoid.Died:Connect(onDeath)
   onDeath(script.Parent.Humanoid.Health > 0)

EDIT

I have shortened the script a lot now (thank u incapaz) but it still doesn't seem to work..

function onDeath()
	game.Workspace.mainwall.CanCollide = false
end
    onDeath(script.Parent.Humanoid.Health > 0)

EDIT 2:

still haven't fixed the problem, but now studio won't work for me, giving me a "cant open place" error (has to do with team create i think), but i would still appreciate any suggestions for the script to work, thank u.

6 comments

0

The Died event has no parameters. Anything passed to it will be nil.

0

thank you, should i replace the "died" part with something else to tell the script the humanoid is dead? or remove that part completally?

0

Remove the Humanoid parameter on line 1. It's pointless.

0

i have shortened it to 4 lines now, but it still doesn't seem to work, i edited the new script in my post

0

you do realize, that means it will make the parts collison off for all players

0

i was hoping it would do that, im trying to make the collision off forever, since this is for a single player game

1 answer

✓ Accepted answer

I don't see why this wouldn't work:

function onDeath()
    workspace.mainwall.CanCollide = false
end

script.Parent.Humanoid.Died:Connect(onDeath)

Are you receiving any errors? If so, please tell us what they are so we can try to fix your problem. Also, did you change the name of the wall? In the two pieces of code you have in your question, you are changing CanCollide to false for 2 different parts.

2 comments

0

FOUND THE PROBLEM! the script was in the main script for the whole zombie, but making the 5 lines into their own script fixed the issue.

0

Ah.

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