Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

The Leaderstat Value Wont Go Up In The Main Game But It Goes Up In Studio?

Heres the script.~~~~~~~~~~~~~~~~~

















local description = "You got a Power Star!!!!!"


local respawn = true



local debounce = false

script.Parent.Touched:connect(function(part)
	
	if not debounce then
		debounce = true
		
		local player = game.Players:GetPlayerFromCharacter(part.Parent)
		if player then
			if player:findFirstChild("OneTimeItems") and player:findFirstChild("leaderstats") and not player.PlayerGui:findFirstChild("ItemGet") then
				if not player.OneTimeItems:findFirstChild(identifier) then
					
					--create an identifier (accoutrements have cool icons)
					local newidentifier = Instance.new("Accoutrement",player.OneTimeItems)
					newidentifier.Name = identifier
					
					--update stats
					local stats = player.leaderstats:findFirstChild(stat)
					if stats then
						stats.Value = stats.Value + 1
					else
						print(stat.." not found in leaderstats")
					end

1 comment

0

findFirstChild and connect and the parent argument are deprecated, use FindFirstChild, Connect, and assign the parent in another line, last

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.