I've ran into this issue numerous times when I make something that involves using PlayerAdded. The script is inside a GUI, and is a LocalScript.
local Players = game:GetService("Players") function onPlayerAdded(player) local mainMenu = script.Parent mainMenu.Name = "Main Menu" local frame = mainMenu:WaitForChild("Frame") frame.Parent = mainMenu frame.Visible = true end Players.PlayerAdded:connect(onPlayerAdded) for _,player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end --Plays menu music local MenuMusic= script.Parent.MenuMusic MenuMusic:Play()
EDIT: I fixed it by replacing various lines with others.
Continued.
local playButton = script.Parent local MenuMusic = script.Parent.Parent.Parent.MenuMusic script.Parent.MouseButton1Click:connect(function() print("Clicked") script.Parent.Parent.Parent.MenuMusic :Stop()