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

Cancollide is true for only one npc sword?

So I'm making a game with npc's using swords which has a damage script but doesn't actually attack, I have a cancollided shield which can block the damage script for a lil. In the first npc's sword handle, I put this script in the handle.

game.Workspace["Bandit"].Sword.Handle.CanCollide = true

Its works for 1 npc but when I put the same script on the second npc, the npc sword isn't cancollided.

7 comments

0

And does this need to be a local script? I'm not really experienced with scripting.

0

Are you copying that exact script into all of the other ones?

0

Is your script currently a local script?

0

nope. Just a normal script

0

the script is INSIDE the handle of the sword, correct? and its duplicated into every handle?

0

ye the script is inside the handle, and its the same script on the second npc's sword handle.

0

I now know (or think I know) whats wrong, I'll post my answer as an actual answer in a moment.

1 answer

✓ Accepted answer

You could giving the 'Bandits' different names such as 'bandit1' and 'bandit2'

Alternatively you could put the script in the handle, as you have, and use this code :

script.Parent.CanCollide = true

Basically it removes all the areas causing the problem, and also shortens the script a fair bit! I hope that this solves your problem ???

2 comments

0

Thank you 2 for this! It works!

0

you're very welcome ???

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