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

killing a zombie make a part uncollidable?

Asked by 6 years ago
Edited 6 years ago

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.

0
The Died event has no parameters. Anything passed to it will be nil. User#19524 175 — 6y
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? bowsercow 20 — 6y
0
Remove the Humanoid parameter on line 1. It's pointless. User#19524 175 — 6y
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 bowsercow 20 — 6y
View all comments (2 more)
0
you do realize, that means it will make the parts collison off for all players greatneil80 2647 — 6y
0
i was hoping it would do that, im trying to make the collision off forever, since this is for a single player game bowsercow 20 — 6y

1 answer

Log in to vote
0
Answered by
lunatic5 409 Moderation Voter
6 years ago

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.

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. bowsercow 20 — 6y
0
Ah. lunatic5 409 — 6y
Ad

Answer this question