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

changing material help?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

Idk why, But I think this should work, it's not changing the material so I think it errors at the second if statement

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

1 answer

Log in to vote
0
Answered by 8 years ago

There's some errors on what your trying to do. The Clicked should be onClicked()

    function onClicked()
    local GetBoat = game.Players.LocalPlayer.Character
        local colorfulls = GetBoat.NormalBoat:GetChildren("Colorfull")
               for i = 1, #colorfulls do
            if colorfulls[i].Name == "Colorfull" then
                if colorfulls[i].Material == "Plastic" then
            colorfulls[i].Material = "Neon"
            script.Parent.booton.TextColor3 = Color3.new(255,0,0)
                else
                colorfulls[i].Material = "Plastic"
            script.Parent.booton.TextColor3 = Color3.new(255,255,255)
            end
            end
        end
    end
    script.Parent.booton.MouseButton1Click:connect(onClicked)
0
Hope it helps or if not tell me the error you get. GreekGodOfMLG 244 — 8y
0
didn't work, yet there are no errors, so I don't know? NotSoNorm 777 — 8y
0
Hmm.. so can you explain the issue here: https://code.stypi.com/greekgodofmlg/Lua%20Helping!!!.lua GreekGodOfMLG 244 — 8y
Ad

Answer this question