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

How do I make a brick react and change other bricks when somebody touches it?

Asked by 7 years ago

I'm brand new to scripting, and simply don't know how. I've tried a few things, but none of them work. If somebody could tell me how to make it react and then change other bricks, that would be great.

0
An example of what you're attempting to do, and any code if you have it. Simply telling us "change other bricks" doesn't tell us what you're attempting to do here. Thanks in advance. BinaryResolved 215 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Well, the best thing here is the onTouched function. It is put into a script like so:

function onTouched(hit) ---The function
---your code
end

script.Parent.Touched:connect(onTouched) ---Connect to onTouched function.

Changing BrickColor and Material is fairly easy.

game.Workspace.PARTNAME.BrickColor = BrickColor.new("COLORNAME")
---Color changing


game.Workspace.PARTNAME.Material = "MATERIALNAME"
---Material changing

Hope you learned something from this. Also, hey creeper didn't expect you to be here lol.

Ad

Answer this question