How do I make it if I touched a textbutton the material of the part will change locally?
So I did this and put this in my screengui placed in startergui
local workspace = game:GetService(“Workspace”)
local UserInputService = game:GetService(“UserInputService”)
local MaterialService = game:GetService(“MaterialService”)
local g1p = game.Workspace:FindFirstChild(“Test2”)
detector.MouseButton1Click:Connect(function()
local textButtonSwitch = false
g1p.Material = Enum.Material.Plastic
local textButtonSwitch = true
end)
And when I click on the textbutton it says this error Players.angelafaye0223.PlayerGui.Inv.LocalScript:16: attempt to index nil with ‘Material’
and it doesnt change the material. Any solutions?