so what this script does is find a tool called "Tape" and when it collides with the part, it adds 1 to the "Points" value in the leaderstats. however, despite NO ERRORS IN OUTPUT, AND WITH EVERYTHING SPELLED CORRECTLY, the script dosent work, please help!
script.Parent.Touched:connect(function(p)
if p.Parent.Name == "Tape" then
amnt = 2
local h = game.Workspace:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:findFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local score = stats:findFirstChild("Points")
if (score~=nil) then
score.Value = score.Value + amnt
end
end
end
end
end)
this script is located inside workspace inside a model inside a part, so if you wanted to go to workspace, It would be script.Parent.Parent.Parent

2 comments
Try to use :FindFirstChild() instead of :findFirstChild() . It works the same way too. And also your leaderstats might be named wrong.
like i said, all spelling was correct, i tried this tihng, but with already existing methods that i knew worked, instead of attempting this.