Nothing will show up in output

Why won’t this script work im a bit new to scripting

 local Click = script.Parent.ClickDetector
local Players = game:GetService("Players")

local function Sayname()
	print(Players.LocalPlayer)
end

Click.MouseClick:Connect(Sayname)
1 Like

clickDetector.MouseClick returns the player that clicked the button so i assume you are using a script and not a local script instead do this:

 local Click = script.Parent.ClickDetector

local function Sayname(plr)
	print(plr.Name)
end

Click.MouseClick:Connect(Sayname)
2 Likes