Provide an overview of:
- What does the code do and what are you not satisfied with:
Code works pretty well, and i am pretty much satisfied with it. But i would like to know if there any better ways of doing it!
Code was designed by me from scratch for animation testing.
How does it work? you just put id of an animation in the table and it will load it. (Game will also need to have pre-made dummies in the special workspace folder , dummies must have a number in dummy’s name)
- How (specifically) do you want to improve the code?:
I was wondering if there any ways to make it less performance usage and more professional looking and working of course!
(i am also wondering, if it’s possible for this script to work in the local scripts.)
Additional Info: Script’s parent is a pre-made workspace folder, script’s type: is a server side one.
--[[Made by @XGoogster ! :D
SETTING UP:
Put this script in a folder where your test dummies are.
(if you do not have it then create it and put your test dummies there, do not forget to add numbering to the end of their names.)
]]
local animation_fortests = {[1] = 10884161872} --type your ids here!
local folder_name = "fortests" --type your's folder name here!
--[[
WARNING!
Be careful exploring anything down there if you are not an experienced user!
You might break the whole script by editing something on accident.
]]
local folder = workspace:WaitForChild(folder_name)
local debris = game:GetService("Debris")
local function load_anims(num)
for i, v in pairs(folder:GetChildren()) do
if v:IsA("Model") and tonumber(string.match(v.Name, "%d+")) == num then
--ignore prints:
--print("works")
print(num)
--print(animation_fortests[num])
local id = "rbxassetid://"..animation_fortests[i]
--print(id)
local hum = v:FindFirstChild("Humanoid")
local animation = Instance.new("Animation")
animation.AnimationId = id
animation.Parent = hum
local load_anim = hum:LoadAnimation(animation)
if load_anim.Looped == false then
load_anim.Looped = true
end
debris:AddItem(animation, 1.5)
load_anim:Play()
print("Done")
end
end
end
for i=0,#animation_fortests, 1 do
load_anims(i)
task.wait(0.2)
end
--ignore that down here.
--local num = tonumber(string.match(folder.dummyblade_slash1.Name, "%d+"))
--print(folder.dummyblade_slash1, num)
Thanks for any help you provide to me!