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

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

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!

3 comments

0

You know how to make it throwable?

0

Use .Touched

0

Yeah, I made a throw-able but the problem was it wouldn't change the color of the wall

2 answers

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.

3 comments

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 :)

0

Thank Redcommander. :)

0

Appreciate it mate, this helps a little.

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.

1 comment

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!

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