Getting attribute value

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 not create a hitbox if player’s stun attribute == true but idk how
  2. What is the issue? Include screenshots / videos if possible!
    This doesn’t work
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

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!
I tried a lot but nothing worked

-- Player Information
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		local Animator = Humanoid:WaitForChild("Animator")
		local RootPart = Character:WaitForChild("HumanoidRootPart")
		local Stun = Humanoid:GetAttribute("Stun")
	print(Stun)
	if Stun == false then
-- this is how i set it up
game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Hum = Character:WaitForChild("Humanoid")
		Hum:SetAttribute("Stun", false)
	end)
end)

Sorry but can you explain it better please?

I want to check if an attribute in the players humanoid named “Stun” is true or false

You already did it in the first script you sent, but some code is missing at the end

-- Player Information
		local Character = Player.Character
		local Humanoid = Character:WaitForChild("Humanoid")
		local Animator = Humanoid:WaitForChild("Animator")
		local RootPart = Character:WaitForChild("HumanoidRootPart")
		local Stun = Humanoid:GetAttribute("Stun")
if Stun == false then
               print("Humanoid is nos stun")
elseif Stun == true then
              print("Humanoid is stun")
else
              print("Attribute Stun doesn't exists in Humanoid")
end
1 Like

This always prints false even if i change the attribute

I will record a video with the thing

Oh I see, the server cannot see the changes you made with an attribute in your client

Try to change the value of the attribute in the server and see if it works

1 Like

Thank you that worked just right

1 Like

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