Hello there I have a doubt scripting this, how do I make this? when you touch a brick you recieve a player point, now I have this script, but I am not sure if its correct
local egg = script.Parent egg.Touched:connect(function(part) local g = game.Players:GetPlayerFromCharacter(part.Parent) if part:IsA("Part") and (g) then local f = g:findFirstChild("leaderstats") local n = f:FindFirstChild("Points") n.Value = n.Value + 1 egg:remove() end end)
That script has nothing to do with Player Points. Therefore, I will transform your script to work with player points. Note the game will need some stored.
local egg = script.Parent egg.Touched:connect(function(part) local g = game.Players:GetPlayerFromCharacter(part.Parent) if part:IsA("Part") and (g) then pps = game:GetService("PointsService") if pps:GetAwardablePoints() >= 1 then pps:AwardPoints(g.userId, 1) end egg:remove() end end)