I want make a ball that when a player touches it, It will change the color of the ball into the same color of the player's torso. Lets say if my torso color is green When touch it, it turns green.
--script inside of the ball local ball = script.Parent --a reference to the ball. We can manipulate the ball's properties using this variable. ball.Touched:connect(function(hit) --We are listening for the touched event on the ball. --When the ball is touched, it runs the given code, and sets the variable "hit" to whatever touched the ball. if hit.Parent:FindFirstChild("Humanoid") then --check to see if parent of whatever hit the ball has a humanoid --if the parent contains a humannoid, then it will run the given code. ball.BrickColor = hit.Parent:FindFirstChild("Torso").BrickColor --change the ball's color to the color of the player's torso end end)
You can do this two ways. 1, part.BrickColor = BrickColor.new(player.Character.Torso.BrickColor) or part.BrickColor = BrickColor.new(player.Character["Body Colors"].TorsoColor). Keep in mind that this isn't a request site next time.