Why isn't this script working?

OnClicked is a function, Functions do not have a parent.
However in this line you can pass in this
function OnClicked(PlayerClicked)
and this will be the Player who clicked it :slight_smile:

function OnClicked(Player)
if Clicked == false then
		Player.leaderstats1.Exp = Player.leaderstats1.Exp + 10
		Player.Team = game.Teams.Citizen
Clicked = true
elseif Clicked == true then 
	
Clicked = false
end
end
script.Parent.ClickDetector.MouseClick:Connect(OnClicked)
1 Like