#how to change a player's animations based on their character in a battlegrounds game
1 messages · Page 1 of 1 (latest)
nicely done but you need to use OOP man module script alone isn't enough
do you know how to do OOP in lua?
oh and I can see you didn't mention module as a variable maybe the video is cut but also you never return the character array which means the whole module won't work.
and wrong use of module script cause module script does not pass the same data in side it so every time you append new thing to that table the table is then gone forever so that means that character table is always empty
wym by the second one
what i would do is firstly make the animations, upload them to roblox and then store them in a module script under the character
when u spawn in, there is a signal for characterAdded, i use that.
i would then get the humanoid
and by using
Humanoid.Running:Connect(function(speed: number)
end)
if the speed is 0, i stop all other anims and play the idle animation
if for example you have a walk/sprint system, and the walking speed is 12, if the speed value is under 12, you'd play the walk animation
and if its over 12 you eould play your run animation
i apologize for big yap, but it had to be done
when u have ur animation IDs you would need to create an 'Animation' instance and would need to load it
but I am pretty sure they mention it earlier in the code and didn't recorded
or you mean wrong use of module script they tried to make the module script stored character in side an array
which in this case the module script will store the value but that instance of an array are not global so it will be deleted after appending
or maybe I just got it wrong
im describing on how I would implement it
Fr use OOP for this is the best option in my opinion
@ocean ibex it fully works as far as switching characters and weapons, no, i have no clue what oop is, and its stored in replecated storage, i call it using Top Bar plus, the bar that most battlegrounds use
i also still need the part that adds the moves, but first i need... you know... moves to add
and thank you on the well done, i was worried that my way of doing it was unnecesary or jank
just determine what animation you need to play based on whatever character the player has selected when they attack, oop (classes) make it easier if you know what youre doing but its not necessary
@odd hound do classes in studio work similer to classes in java? im very familier with java so if there are it should be a breeze