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

Problems changing material help?

I have this script, It "SHOULD" work but qq ya kno. It only works once, is the thing (click once) and it changes every part not just ones called 'Colorfull'

function onClicked()
local GetBoat = game.Players.LocalPlayer.Character
local colorfulls = GetBoat.NormalBoat:GetChildren()
local boot = GetBoat.NormalBoat
for i,v in pairs(colorfulls) do
    if v.Name=="Colorfull" then
	if boot.Colorfull.Material == "SmoothPlastic" then
        for i = 1, #colorfulls do
                colorfulls[i].Material = "Neon"
       end
script.Parent.booton.TextColor3 = Color3.new(255,255,255)
    else
        for i = 1, #colorfulls do
            colorfulls[i].Material = "Plastic"
         end
            script.Parent.booton.TextColor3 = Color3.new(255,0,0)
       end
 end
    end
end
script.Parent.booton.MouseButton1Click:connect(onClicked)

1 answer

✓ Accepted answer

Your problem is on line 7 in that code block. Enums are not Strings!

if boot.Colorfull.Material == Enum.Material.SmoothPlastic then

1 comment

0

Thanksm80

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