local top = script.Parent.Top
function onStop()
top.Material = "Neon"
end
local bottomLeft = script.Parent.BottomLeft
local bottomRight = script.Parent.BottomRight
function onAhead()
bottomLeft.Material = "Neon"
bottomRight.Material = "Neon"
end
local aheadButton = script.Parent.On
local stopButton = script.Parent.Off
aheadButton.ClickDetector.MouseClick:Connect(onStop)
if top.Material == "Neon" then
top.Material = "Plastic"
end
stopButton.ClickDetector.MouseClick:Connect(onAhead)
if bottomLeft.Material == "Neon" and bottomRight.Material == "Neon" then
bottomLeft.Material = "Plastic" and bottomRight.Material == "Plastic"
end```
When I click one of the buttons again, it doesn't go back to Plastic.
Any ideas?
You’re trying to set a part’s material with a string.
top.Material = "Plastic"
In order to change the Material and many other properties that you select off a dropdown list, you need to call Enum
top.Material = Enum.Material.Plastic
Change this for the other times you change part materials and it should work. Let me know.
local top = script.Parent.Top
function onStop()
top.Material = "Neon"
end
local bottomLeft = script.Parent.BottomLeft
local bottomRight = script.Parent.BottomRight
function onAhead()
bottomLeft.Material = Enum.Material.Neon
bottomRight.Material = Enum.Material.Neon
end
local aheadButton = script.Parent.On
local stopButton = script.Parent.Off
aheadButton.ClickDetector.MouseClick:Connect(onStop)
if top.Material == Enum.Material.Plastic then
top.Material = Enum.Material.Plastic
end
stopButton.ClickDetector.MouseClick:Connect(onAhead)
if bottomLeft.Material == "Neon" and bottomRight.Material == "Neon" then
bottomLeft.Material = Enum.Material.Plastic and bottomRight.Material == Enum.Material.Plastic
end```
It works when input, but when I click again it doesn't change plastic.
It works when input, but when I click again it doesn’t change plastic.
You also forgot changes here
Also, what is this meant to be?