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

Value not being named?

if not plr:FindFirstChild("Stats") then
	local stats = Instance.new("IntValue",plr)
		stats.Name = "Stats"
		
		wait(.1)
	
		local ad = Instance.new("IntValue",stats)
			repeat ad.Name = "Attack" wait() until ad.Name == "Attack" --This one is not being named attack, just Value
			ad.Value = math.random(60,80) --Also, it doesn't set this value. It basically just gets created, unchanged, then it just stops.
			
		wait(.1)
		print(ad.Name)
		
		local ap = Instance.new("IntValue",stats)
			repeat ap.Name = "Spell" wait() until ap.Name == "Spell" --This one is also not being named, just stays at Value
			ap.Value = 0
			
		wait(.1)
		print(ap.Name)
		
		local ar = Instance.new("IntValue",stats)
			ad.Name = "Armor"
			ad.Value = math.random(20,30)
			
		wait(.1)
		
		local mr = Instance.new("IntValue",stats)
			ap.Name = "MagicResist"
			ap.Value = math.random(5,20)
			
		wait(.1)
		
		local gd = Instance.new("IntValue",stats)
			gd.Name = "Gold"
			gd.Value = 0
			
		wait(.1)
		
		local lh = Instance.new("ObjectValue",stats)
			lh.Name = "LastHit"
			
		wait(.1)
		
		local bty = Instance.new("IntValue",stats)
			bty.Name = "Bounty"
			bty.Value = 0
			
		wait(.1)
		
		local mh = Instance.new("IntValue",stats)
			mh.Name = "MaxHealth"
			mh.Value = 900 + math.random(0,200)
			
		wait(.1)
		
		char:WaitForChild("Humanoid").WalkSpeed = 16 + (math.random(10)/10)
		
		script.PassiveGold.Disabled = false
		
		
end

2 comments

0

Is there a reason why you're setting their names in repeat loops...?

0

I am trying to make sure they are named that. It was an attempted fix.

1 answer

✓ Accepted answer

Check that your names match up. You had this:-

local mr = Instance.new("IntValue",stats) 
ap.Name = "MagicResist" 
ap.Value = math.random(5,20) 

Instead of this:-

local mr = Instance.new("IntValue",stats) 
mr.Name = "MagicResist" 
mr.Value = math.random(5,20) 

And this one needs to be changed as well:-

local ar = Instance.new("IntValue",stats) 
ad.Name = "Armor" 
ad.Value = math.random(20,30)

1 comment

0

Oh. Derp. I didn't even notice that. Thanks, it worked!

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