local Clicked = false
function OnClicked()
if Clicked == false then
local player = OnClicked.Parent
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)
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
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)