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

changing material help?

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

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)

3 comments

0

Hope it helps or if not tell me the error you get.

0

didn't work, yet there are no errors, so I don't know?

0

Hmm.. so can you explain the issue here: https://code.stypi.com/greekgodofmlg/Lua%20Helping!!!.lua

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