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

How do I change the properties of multiple values at once?

Asked by 8 years ago

function whenClicked() local plr = game.Players.LocalPlayer local playerpos = plr.Character.Torso.Position local rightlightpos = game.Workspace.FlashLight2.Union.Position local difference = playerpos - rightlightpos local number = 50 if difference.magnitude < number then local xa = game.Workspace.Lobbthing.Part xa.BrickColor = BrickColor.new("Black")

end

end

script.Parent.MouseButton1Down:connect(whenClicked)


The purpose of this script is to change the color value of a part within a model called "Lobbthing", once a player is a certain distance away from another object. However, my goal is to make this script work for all of the objects in the model called "Part" and that does not happen. I know that there is a way to do this but at my current stage within this language I am unable to do that. Note: This script activates when two conditions are met: 1) A Button in a GUI has been clicked. 2) The Player is less than 50 studs away from another object, in this case being rightlightpos.

Answer this question