I was just trying to make a simple button. But of course the button decides not to work because I probably made a mistake. I am scripting in a local script just putting this out there. Someone please help me.
Code:
--Made By: Troloolooolooll local button = script.Parent button.MouseEnter:connect(function() button.BackgroundColor3(141, 141, 141) end) button.MouseButton1Click:connect(function() local player = game.Players.LocalPlayer print(player.Name) end) button.MouseLeave:connect(function() button.BackgroundColor3(80, 80, 80) end)
Edited: I put my gui in a folder. When I took it out of the folder it worked.
When changing the Color value of an object in RGB, you need to use Color3.new. But, you would also need to divide all three values, R, G, and B, by 255 or it will always be completely black or completely white. Inclusively make sure that the button is visible and accessible on the screen. My button was a TextButton residing in a ScreenGui.
local button = script.Parent button.MouseEnter:connect(function() button.BackgroundColor3 = Color3.new(141/255, 141/255, 141/255) end) button.MouseButton1Click:connect(function() local player = game.Players.LocalPlayer print(player.Name) end) button.MouseLeave:connect(function() button.BackgroundColor3 = Color3.new(80/255, 80/255, 80/255) end)