Here is my script:~~~~~~~~~~~~~~~~~ player = game.Players.LocalPlayer
script.Parent.Touched:Connect(function(hit)
if player.hit then player.leaderstats.points.Value = points.Value + 1 end
end)
And then my LeaderBoard script~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:Connect(function(player) stats = Instance.new("IntValue",player) stats.Name = "leaderstats" points = Instance.new("IntValue",stats) points.Name = "Points" end)
Localscript's do not work when parented to the workspace or a part that is inside the workspace instead use a server script not a local script and place this code inside it and parent it to the part
function Touch (hit) if hit.Parent:FindFirstChild('Humanoid') then local Player = game.Players:GetPlayerFromCharacter(hit.Parent) local leaderstats = Player:WaitForChild('leaderstats') local Points = leaderstats:WaitForChild('Points') Points.Value = Points.Value + 1 end end script.Parent.Touched:Connect(Touch)