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

Detect Value System Not Working [No Output, Error] ?

game.Players.PlayerAdded:Connect(function(player)
	local playerinfo = player:WaitForChild("Info")
	local playerleaderstats = player:WaitForChild("leaderstats")

	local playerstrengthh = playerinfo:WaitForChild("Strength").Value
	local playerstrength = playerinfo:WaitForChild("Strength")

	local playerquest = playerinfo:WaitForChild("Quest")

	local playerprogress = playerinfo:WaitForChild("QuestProgress")

	playerinfo:WaitForChild("Strength").Changed:Connect(function(value)
		if playerinfo:WaitForChild("Strength").Value < 0 then
			playerinfo:WaitForChild("Strength").Value = 0
		else
			return
		end

		wait()

		local StrengthAdded = value - playerinfo:WaitForChild("Strength").Value
		print(StrengthAdded)

		if StrengthAdded > 0 then
			if playerquest.Value == "MayorC" then
				playerprogress.Value += StrengthAdded
			end
		end

		wait()
		playerinfo:WaitForChild("Strength").Value = value
	end)
end)

Somehow it just wont work

plis help

1 answer

leaderstats is an optional child to a player. It is not parented under a Player instance on join by default, you have to create it yourself. The :WaitForChild will wait forever or until the "infinite yield possible" warning appears.

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