1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Output entity type with underscores

Discussion in 'Skript' started by ZhengYueMoon, Mar 18, 2023.

  1. ZhengYueMoon

    ZhengYueMoon Member

    Joined:
    Mar 9, 2022
    Messages:
    16
    Likes Received:
    0
    so when player kills an entity, it will return the type of the entity, however entity that have spaces in their type name will display with the spaces like "iron golem", "ender dragon", etc. so instead, i want it to output them with underscores like "iron_golem", "ender_dragon", etc.
    anyone have any idea on how to do that?
    Code (Text):
    1. on death:
    2.     if attacker is player:
    3.         send "%victim's type%" to attacker
    4.         #when I kill an iron golem, it sends me "iron golem" instead of "iron_golem"
    --- Double Post Merged, Mar 18, 2023, Original Post Date: Mar 18, 2023 ---
    nevermind i found the solution
    im gonna post it here if anyone also have that problem
    Code (Text):
    1. on death:
    2.     if attacker is player:
    3.         set {_type} to "%victim's type%"
    4.         replace all " " with "_" in {_type}
    5.         send "%{_type}%" to attacker
     

Share This Page

Loading...