local hitpart = script.Parent local function onclick(click) local h = click.Parent:FindFirstChild("Humanoid") if h then print('it works') local player = game.Players:GetPlayerFromCharacter(click.Parent) player.PlayerGui.Song.Frame.Visible = true end end hitpart.ClickDetector.MouseClick:connect(onclick)
Please help explain where I went wrong.
local hitpart = script.Parent local function onclick(player) print("It Works") player.PlayerGui.Song.Frame.Visible = true end hitpart.ClickDetector.MouseClick:connect(onclick)
The MouseClick event returns the player, not the character. Hope this helps