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

Cancollide is true for only one npc sword?

Asked by
Rdumb1 4
5 years ago
Edited 5 years ago

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.

0
And does this need to be a local script? I'm not really experienced with scripting. Rdumb1 4 — 5y
0
Are you copying that exact script into all of the other ones? blockmask 374 — 5y
0
Is your script currently a local script? User#24928 0 — 5y
0
nope. Just a normal script Rdumb1 4 — 5y
View all comments (3 more)
0
the script is INSIDE the handle of the sword, correct? and its duplicated into every handle? User#24928 0 — 5y
0
ye the script is inside the handle, and its the same script on the second npc's sword handle. Rdumb1 4 — 5y
0
I now know (or think I know) whats wrong, I'll post my answer as an actual answer in a moment. User#24928 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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 ???

0
Thank you 2 for this! It works! Rdumb1 4 — 5y
0
you're very welcome ??? PoppyandNeivaarecute 134 — 5y
Ad

Answer this question