I am trying to maketwo buttons visible when other button gets clicked, but mousebutton1click is not detected. does anyone know how to fix it?
local landTerraformationButton = game.StarterGui.ScreenGui:WaitForChild("TerraformButton");
local upButton = game.StarterGui.ScreenGui:WaitForChild("UpTerraform");
local downButton = game.StarterGui.ScreenGui:WaitForChild("DownTerraform");
landTerraformationButton.MouseButton1Click:Connect(function()
print("ok");
upButton.Visible = not upButton.Visible
downButton.Visible = not downButton.Visible
end)
You’re detecting the MouseButton1Click in StarterGui, which are not the same as the one in player.PlayerGui.
You need to find the player and use it from there
local plr = game.Players.LocalPlayer
local gui = plr.PlayerGui
local landTerraformationButton =gui.ScreenGui:WaitForChild("TerraformButton");
local upButton = gui.ScreenGui:WaitForChild("UpTerraform");
local downButton =gui.ScreenGui:WaitForChild("DownTerraform");
landTerraformationButton.MouseButton1Click:Connect(function()
print("ok");
upButton.Visible = not upButton.Visible
downButton.Visible = not downButton.Visible
end)