I'm currently making a game where you have to find presents. I want to make it so that when you touch a present it changes to green and adds one point to your leaderstats value. I also want to make sure that if you touch a present that has already been touched it wont give you another point. In one script under the first present I've done this:
script.parent.Touched:Connect(function(hit)
game.Workspace.Presents.Present1.Mainpart.Color = Color3.new(0.0730297, 0.630625, 0)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Presents = Instance.new("IntValue", leaderstats)
Presents.Name = "Presents"
Presents = Presents * 1
end)
end)
I also have another script under server script service that is making the leaderstats:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Presents = Instance.new("IntValue", leaderstats)
Presents.Name = "Presents"
end)
I hope this makes sense

1 comment
Thank you so much