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

How to make a projectile/object change wall color on impacts!?

Asked by 6 years ago

How do I make it so that if I throw a ball at a wall it changes color. Or any object. Something that's a sort of projectile. T'would really appreciate it!

0
You know how to make it throwable? HeyItzDanniee 252 — 6y
0
Use .Touched Le_Teapots 913 — 6y
0
Yeah, I made a throw-able but the problem was it wouldn't change the color of the wall DrRubberNut -5 — 6y

2 answers

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

If you throw it just use touched event. When the ball touches the wall code in a line that changes the wall color. You can use a any color or random color.

Dont know if it works, new to scripting, but try it. Hope it works.

0
In case that guy doesn't know how to script: local projectile = script.Parent projectile.Touched:connect(function(hit) if hit and hit:IsA('BasePart') and not.Parent:FindFirstChild('Humanoid') then hit.BrickColor = BrickColor.new('Really Red') end end) -- I might did something wrong but that should work :) User#20388 0 — 6y
0
Thank Redcommander. :) HeyItzDanniee 252 — 6y
0
Appreciate it mate, this helps a little. DrRubberNut -5 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

In case of a part:

_G.part = script.Parent.Part1
_G.part2 = script.Parent.Part2

part.Touched:Connect(function()
    if part2:FindFirstChild("Part1") then
        part.BrickColor = Color3.new(255,0,0) -- Turns part red
        part2.BrickColor = Color3.new(0,255,0) -- Turns part2 green
    end
end)

In case of a projectile or tool handle:

_G.handle = game.StarterPack.Tool.Handle
script.Parent.Touched:Connect(function()
    if script.Parent:FindFirstChild("Handle") then
        handle.BrickColor = Color3.new(0,0,203) -- A lovely shade of blue
    end
end)

Color3 always works. You can use BrickColor.new() if you don't understand color values, but I recommend Color3 as you can get names of colors not initially available.

0
Idk, none of this is working for me. I think I need to recreate my projectile, or ball in this instance. Thanks for the response though! DrRubberNut -5 — 6y

Answer this question