I have a script that has script.Parent:MouseButton1Click:Connect(), but it still runs without the player even clicking the button, how could i fix this problem? There is no error output, it just runs.
local playerGui = game.Players.LocalPlayer:FindFirstChild("playerGui") local weaponScreen = game.Players.LocalPlayer.PlayerGui:WaitForChild("weaponScreen") script.Parent.MouseButton1Click:Connect() game.Players.LocalPlayer.PlayerGui.weaponScreen.Enabled = true script.Parent.Parent.Parent.weaponScreen.loadoutBG.Visible = false script.Parent.Parent.Parent.mainOverlay.dBG.Visible = false script.Parent.Parent.Parent.mainOverlay.wBG.Visible = false script.Parent.Parent.Parent.mainOverlay.weaponsButton.Visible = false script.Parent.Parent.Parent.mainOverlay.weaponsButton.Visible = false
Make the Connect() Into a Function, without doing so it would run when you play/test the game.