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

How can I make it so this script targets it's Name instead of ClassName?

Asked by 6 years ago

I want this script to target anything that is named "Accessory2" instead of it's ClassName "Accessory", how would I change the script to do so?

local variable = script.Parent:WaitForChild("ClickDetector") variable.MouseClick:Connect(function(p) if p.Character then for _,v in next,p.Character:GetChildren() do if v:Is("Accessory") then v.Part2.Mesh.VertexColor = Vector3.new(0, 0, 0) end end end end)

1 answer

Log in to vote
0
Answered by 6 years ago

Just change it to v.Name == "Accessory2"

0
Works great, thank you! felonymartinez 12 — 6y
Ad

Answer this question