1

How to change a players health?question_answer

MythicMango's Avatar MythicMango10/22/21 7:19 pm history
1 emeralds 2.4k 9
10/25/2021 12:52 am
MythicMango's Avatar MythicMango
I tried looking through many tutorial and they all never work, I'd like to know how to change a players health to something like 5 hearts. They all always involve the /attribute command and they are like this: /attribute @s minecraft:generic.max_health base set 1000.0. It never works!!!



Thank you for reading, hopefully someone help me with how.

(I solved it so don't worry about it when you find this, :D .)
Posted by MythicMango's Avatar
MythicMango
Level 34 : Artisan Toast
23

Create an account or sign in to comment.

9

1
10/24/2021 9:53 pm
Level 59 : Grandmaster Nerd
Pleasenotme
Pleasenotme's Avatar
What version are you on?
1
10/24/2021 9:26 pm
Level 61 : High Grandmaster Senpai
YokaiS
YokaiS's Avatar
that command should work. what version are you on? do you have cheats enabled? are you on java or bedrock? how are you running the command?
1
10/25/2021 12:43 am
Level 34 : Artisan Toast
MythicMango
MythicMango's Avatar
I'm on the latest version 1.17 I have them enabled and I'm on Java.
1
10/22/2021 9:15 pm
Level 57 : Grandmaster Skinner
HuLeJo
HuLeJo's Avatar
I am pretty sure it has to be @p not @s. I don't think command blocks understand what you mean by @s.
2
10/23/2021 12:33 amhistory
Level 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
How do you know they're using command blocks?
They could be testing it using their chat or a datapack

And yes command blocks dont understand @s until a button or lever is directly on the block and is pressed by that person
1
10/24/2021 9:19 pmhistory
Level 34 : Artisan Toast
MythicMango
MythicMango's Avatar
I tried and it did not work, is there anyway beside a Datapack since my friend and I are trying to do an animal survival but can't get our health to 5 hearts like the animals we are.
1
10/24/2021 11:18 pmhistory
Level 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
Syntax is this: attribute <target> <attribute> base set <value>
So as YokaiS stated, your command is correct.
Are there any errors (red messages) that appear when you type this up in chat? Are you using command blocks for this?
1
10/25/2021 12:52 amhistory
Level 34 : Artisan Toast
MythicMango
MythicMango's Avatar
I've solved it! You just need to take the amount of damage to make you're health what you set the attribute to, thank you so much.
1
10/22/2021 8:59 pm
Level 52 : Grandmaster Blob
HoboMaggot
HoboMaggot's Avatar
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome