I have made a script to make this orb only add 1 to your stats one time. It works if I do not tweak the specified value in orb folder, however if I attempt to change the value manually in test mode, it still awards an orb collected. The orbfolder has a datastore to it, but it doesnt seem to be the problem as I tested it in studio changing the value myself with the orb still being awarded. If anyone could identify what is wrong, I would appreciate it. My code is below:
game.Players.PlayerAdded:Connect(function(join)
script.Parent.Touched:Connect(function(plr)
local humanoidcheck = plr.Parent:FindFirstChild("Humanoid")
if humanoidcheck ~= nil then
local orbfolder = join.orbfolder
if orbfolder.orb1.Value == 0 then
local orbs = join.leaderstats.Orbs
orbs.Value = orbs.Value + 1
orbfolder.orb1.Value = 1
end
end
end)
end)
Thank you!

4 comments
Delete the PlayerAdded event. See if that helps
It will break the entire script as I need that to find the player's orbfolder.
He is correct, remove the PlayerAdded event and use game.Player:GetPlayerFromCharacter(plr.Parent) to get the player instead
game.Players*