Atrributes not showing

So i have a bunch of attributes but whenever I join the game a lot of them disappeared, it used to work fine but now it doesn’t. and I think its causing some scripts to bug out

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		
		
		---------------- Combat Attributes------------------------------
		char:SetAttribute("Stunned", false)
		char:SetAttribute("IsBlocking", false)
		char:SetAttribute("IsGaurdBroken", false)
		char:SetAttribute("IsAttacking", false)
		char:SetAttribute("KnockBack", false)
		char:SetAttribute("BlockValue", 100)
		
		
		---------------- Armour Attributes------------------------------
		char:SetAttribute("HyperArmour", false)
		char:SetAttribute("SuperArmour", false)
		char:SetAttribute("I-Frames", false)
		
		---------------- Movement Attributes------------------------------
		char:SetAttribute("isDashing", false)
		char:SetAttribute("IsRunning", false)
		char:SetAttribute("IsAir", false)
		char:SetAttribute("IsSwimming", false)
		char:SetAttribute("IsDogdeing", false)
		char:SetAttribute("IsWallClimbing", false)
		char:SetAttribute("CanBeKnocked", false)
		char:SetAttribute("DashType", "Regular")
		
		---------------- Haki Attributes------------------------------
		char:SetAttribute("BusoHaki", false)
		char:SetAttribute("KenHaki", false)
		char:SetAttribute("IsHakiClashing", false)
		char:SetAttribute("NearSeaStone", false)
		char:SetAttribute("CanBusoHakiClash", false)
		char:SetAttribute("CanHaoHakiClash", false)

		
		
		---------------- Passive Attributes------------------------------
		char:SetAttribute("IsBurning", false)
		char:SetAttribute("IsFrozen", false)
		char:SetAttribute("IsPoisoned", false)
		char:SetAttribute("IsBlind", false)
		char:SetAttribute("Iselectrified", false)
		
		---------------- Tool Attributes------------------------------
		char:SetAttribute("WeaponEquiped", false)
		char:SetAttribute("WeaponEquipedAndHeld","")
		char:SetAttribute("WeaponEquipedName", "")
		char:SetAttribute("WeaponEquipedId", 1)
		
		---------------- Miscellaneous Attributes------------------------------
		char:SetAttribute("InCombat", false)
		char:SetAttribute("InJail", false)
		char:SetAttribute("CombatTag", 30)
		
		---------------- Miscellaneous Attributes------------------------------
		char:SetAttribute("IdleAnim", 117259735658130)
		char:SetAttribute("RunAnim", 0)
		char:SetAttribute("DashAnim", 0)

	end)
end)

You need to make sure the player.Character exist first, otherwise it will only work when the player resets.

How would i do that, because i thought the character added function runs if the players character loads in.

You can do like this just by running the function once.

characterAdded(localPlayer.Character)
localPlayer.CharacterAdded:Connect(characterAdded)

thanks, i got another question, im trying play some animations, I have a bunch of swords with different idle animations, and basic idle animation, however, whenever the player switches their sword, it played the sword idle animation without stopping the previous animation, also I have to put for loops within loops to find anything in the folder, how will I make it simpler

No prob, for this you should probably do animation weights.

Not sure for this probably good for a different topic.

Even the ones in the default animation script can be messy and lengthy. It is quite inevitably for every unique animation you add.

I would go for the classic game dev technique of reusing animations for long sword, short sword.

To fix this you will need to create animation tracks.
You can create a track like this:

local idle = Instance.new("Animation")
idle.AnimationId = "rbxassetid://ID"
game:GetService("RunService").Stepped:Wait()
local idleTrack = Animator:LoadAnimation(idle)
idleTrack.Looped = true

Afterwards when you want to stop the idle animation and do the sword idle you can do:

previousIdleTrack:Stop()
swordIdleTrack:Play() --You should do this inside a parent script that is being called with a BindableEvent, RemoteEvent or a different way

I hope this helps

local players=game:GetService("Players")
players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid=character:WaitForChild("Humanoid")  --pause
		task.wait(1.2)  --pause
		
		--
		--
		
	end)
end)

you could use :PreLoadAsync instead of waiting a frame (fps uncapped can break it)

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