I want to make that this script adds 10 points to player after they click a part and this part goes invisible, but it doesnt work.
local Part1 = script.Parent
local CD = Part1.ClickDetector
local function addPoint(playerpoints, part)
local pointadd = 10
playerpoints.Value += pointadd
part.Transparency = 1
end
local function clickedPart(ClickParent)
local character = ClickParent.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
local lb = player:FindFirstChild("leaderstats")
local playerpoints = lb:FindFirstChild("Points")
addPoint(playerpoints, Part1)
end
end
CD.MouseClick:Connect(clickedPart)
