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

Brick changes color after hit by bullet?

Asked by
DeepDev 101
8 years ago

Yeah, I want to change a brick color when hit by bulletThis is my script for now...

function onTouched(hit)
    if hit.Parent.Name=="Bullet"
    then script.Parent.BrickColor = BrickColor.new("Really red")
    end
    end
script.Parent.Touched:connect(onTouched)

But it doesnt do anything, Help me.

1 answer

Log in to vote
0
Answered by 8 years ago
function onTouched(hit)
    if hit.Name=="Bullet"
    then script.Parent.BrickColor = BrickColor.new("Really red")
    end
    end
script.Parent.Touched:connect(onTouched)

The bullet is a part not a model so only but 1 parent in line 2.

0
Oops, Didnt saw that DeepDev 101 — 8y
0
I tryed, it did work with other blocks except for the bullet itself DeepDev 101 — 8y
0
wait so you want the bullet to change color when it hits something? AdministratorGnar 25 — 8y
0
I want that the Target will change color after the bullet hits the target DeepDev 101 — 8y
View all comments (5 more)
0
what do you mean "I tryed, it did work with other blocks except for the bullet itself" AdministratorGnar 25 — 8y
0
I put the script into the block, Then I touched the block with a other part. But if I shoot it It wont change color. BTW the bullet is in a model called: Ray_Ignore DeepDev 101 — 8y
0
First Ray_Ignore does what it says, it ignores stuff, second the bullet might be travelling so fast it doesn't register, to fix this, make it make bullet holes when it hits something and make the script if name="hole" then .. AdministratorGnar 25 — 8y
0
How do I make those bullet holes. I'm new to scripting an all :P DeepDev 101 — 8y
0
I don't know how to explain it, look it up on youtube. AdministratorGnar 25 — 8y
Ad

Answer this question