Categories > Coding > Lua >

Animation script issue

Posts: 3

Threads: 1

Joined: Jan, 2023

Reputation: 0

Posted

I wrote a script to change animations in the game, but after the character dies,
I try to press the change button and nothing happens, only restarting
the script helps
can you suggest quick fix
 
  • 0

Posts: 47

Threads: 6

Joined: Jan, 2023

Reputation: 3

Replied

The animations are based on the Humanoid And HumanoidRootPart, It's destroyed when you're character dies so I'd prefer you create a gui to execute the script from within the game. Or else you could modify the script to re-execute the script when HumanoidRootPart is destroyed.

 

In order to do that you can put the script in a function and put a while true do under the function

 

You can use if not if it still works in the script below. I'm not sure if this is relevant though.

 

function Build()
    --script here
end

while true do
    if game.Players.LocalPlayer.Character.HumanoidRootPart then
        --Do nothing cause you haven't died.
    else
        Build() -- Rexecute script
    end
end
  • 1

Added

@_realnickk Thanks for explaining

  • 0

I bet you a dollar you saw this.

Posts: 2014

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

Giving us your current script would possibly help fixing your script.

  • 0

Random quote here...

Posts: 3

Threads: 1

Joined: Jan, 2023

Reputation: 0

Replied

@Rayn 

 

 it doesn't work, when i run the script with this fix the game just stops working.

  • 0

Added

@VoidableMethod damn, my code is bad because not so long ago I started writing scripts lol. I doubt that anything will help me but I can send you a script so that you can tell me how to solve this problem.

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )