Giving auras and gears depending on the player's number of wins

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to create an advanced obby that gives you auras and gears depending on how many wins you have.
  2. What is the issue? Include screenshots / videos if possible!
    There were no errors but the scripts don’t give me the stuff I want.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried checking how many wins I had, I had 2 wins.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local gears = game.ServerStorage.Gears

local winsGears = {
	{1, gears.GravityCoil},
	{2, gears["Acceleration Coil"]}
}

game.Players.PlayerAdded:Connect(function(plr)
	local wins = plr:WaitForChild("leaderstats"):WaitForChild("Wins")
	
	plr.CharacterAdded:Connect(function(character)
		wait(0.5)
		
		for i, gear in pairs(winsGears) do
			if wins.Value >= gear[1] then
				gear[2]:Clone().Parent = plr.Backpack
			end
		end
	end)
end)
local tags = {
	{1, "Intermediate", "#4dff00"}
	--{5, "Good", "#ffea00"},
	--{10, "Pro", "#ff0000"},
	--{20, "God", "#4000ff"},
	--{30, "Undefeated", "#292929"}
}

game.Players.PlayerAdded:Connect(function(plr)
	local tagColor
	local tagText
	local rank

	plr.CharacterAdded:Connect(function(char)
		wait(0.5)
		
		for i, tag in pairs(tags) do
			if plr.leaderstats.Wins.Value >= tag[1] then
				tagColor = tag[3]
				tagText = tag[2]
				rank = tag[1]
			end
			
			if rank ~= nil and game.ServerStorage.Effects:FindFirstChild(rank) then
				local effect = game.ServerStorage.Effects[rank].Attachment:Clone()
				
				effect.Parent = char.HumanoidRootPart
			end
		end
	end)
end)

I noticed that after I respawn, my character receives the gears.

1 Like

Update: I added some prints and I found out that the rank the script printed is nil. Why?

Just realized that the tags table was wrong. The effects in ServerStorage are named after the rank NAMES not the numbers. Now the only issue left is that the effects and gears only show after I respawn. Not when the player spawns in the first place.

I fixed it. All thanks to you guys. You guys were so helpful! Just look at the replies! So many! (I’m being sarcastic.)

Here is my final script that worked. I put it in the data loading script so the function runs right after the data loads.

Players.PlayerAdded:Connect(function(plr)
	local lvl = loadCheckpoint(plr)
	if lvl ~= nil then
		plr.leaderstats.Level.Value = lvl
	end
	local wins = loadWins(plr)
	if wins ~= nil then
		plr.leaderstats.Wins.Value = wins
	end
	load(plr,plr.Character)
	plr.CharacterAdded:Connect(function(char)
		load(plr,char)
	end)
end)
1 Like

if u didnt say that u were being sarcastic, i wouldnt know