Having trouble making a script that gives the player Unlimited sprint on player spawn.

Topic created · 5 Posts · 42 Views
  • This is my first time actively trying to write and use a script, so I'm brand new to this. Not exactly sure what it is I'm doing wrong. I've gotten the game to load and the bootstrapper is telling me that it's able to execute the script (it doesn't kick me out of the game or anything). But the player sprint is still default, in-game. They sprint for a few seconds and then stop, as usual.
    Anyone know how I can fix this?
    This is the script.
    Screenshot (214).png

  • You have to call your function on the player entity. Like welcome.

  • @Xerxes Thank you. Could you give me an example?

  • @Unfunny_Umi "like welcome" so just do the same
    In code there is always two steps:

    • Declaring a piece of code to make it available
    • Calling that piece of code (function) to actually use it

    Right now you're declaring the unlimited_sprint function, it exists, but it is never called/used on any entity.
    It just sits there but it's never used. Declaring a function doesn't do anything more than making it available.

    You added thread unlimited_sprint() but you don't thread on any object.
    You need to call the function on something (the level, a player etc.)

    So move this below player thread welcome() like Xerxes said.

    for (;;)
    {
        level waittill("connecting", player);
        player thread welcome();
        player thread unlimited_sprint();
    }
    

    This way you are saying "when a player connects thread the unlimited_sprint function on him on that particular player

  • @Resxt You guys are the best. Genuinely, thank you so much.
    I got it working! Much Love!

Log in to reply