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

Problems changing material help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

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

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago

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

if boot.Colorfull.Material == Enum.Material.SmoothPlastic then
0
Thanksm80 NotSoNorm 777 — 8y
Ad

Answer this question