So im attempting to make a flying script with animations but trying to make it work for both RigTypes (r15 and r6) but when I press play I get:
attempt to concatenate string with EnumItem
Heres the code:
local idleAnim = char:WaitForChild(“Humanoid”):LoadAnimation(script[“FlyIdle” … char.Humanoid.RigType])
local forwardAnim = char:WaitForChild(“Humanoid”):LoadAnimation(script[“FlyForward” … char.Humanoid.RigType])
First thong is it’s not … it’s …, and tostring it
oh, in the script its two dots idk why it did that
if i tostring, it comes out with this:
FlyIdleEnum.HumanoidRigType.R6 is not a valid member of LocalScript
heres the code:
local idleAnim = char:WaitForChild(“Humanoid”):LoadAnimation(script[“FlyIdle” … tostring(char.Humanoid.RigType)])
local forwardAnim = char:WaitForChild(“Humanoid”):LoadAnimation(script[“FlyForward” … tostring(char.Humanoid.RigType)])
(devforum keeps updating it to three dots even though its only two, its weird)
The reason it’s not working after using tostring()
is because the string value includes “Enum.HumanoidRigType.” before “R6” or “R15”. You can do something like
string.split(tostring(char.Humanoid.RigType), ".")[3]
It will return “R6” or “R15”
Thanks! that worked, and now this script is compatible with r6 and r15.