Accessory not loading

I’m trying to make passives for my game and I’m encountering issues with adding the accessory, everything print’s up to print("obelisks grace is on"), however it is, and it only adds the accessory and the effect when the player resets, here’s my script:

local obeliskadded = false

game.Players.PlayerAdded:Connect(function(plr)
	print(plr.Name.." added")
	plr.CharacterAdded:Connect(function(char)
		print(char.Name.." char added")
		local statfolder = plr:WaitForChild("StatFolder")
		if statfolder then
			print("statfolder found")
		end
		local passivemodels = game.ReplicatedStorage.Passives
		if statfolder.Passive1.Value == "ObelisksGrace" or statfolder.Passive2.Value == "ObelisksGrace" or statfolder.Passive3.Value == "ObelisksGrace" then
			print("obelisks grace is on")
			wait(3)
			print("obelisk adding")
			repeat wait() until char:FindFirstChild("Humanoid")
			print("humanoid found")
			local humanoid = char.Humanoid
			humanoid:AddAccessory(passivemodels.ObelisksGrace:Clone())
			print("accessory added")
			if obeliskadded == false then
				statfolder.Strength.Value += 5
				obeliskadded = true
			end
		end
	end)
end)

If you can figure out why it’s now working, please tell me, that would be most appreciated.

1 Like

I fixed it, I just had to move the wait(3) above the if statement.

I understand that you’ve already found a solution, but I would like to let you know about the player.CharacterAppearanceLoaded event. This event fires after the character’s clothing and accessories have been completely loaded, and the character model has been parented to the workspace.

player.CharacterAdded fires before the character’s appearance is loaded and before the model is parented to the workspace.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.