Can you parse variables from a script to a loadstring without global variables?

Like for example:

local Player = game.Players.Player1
loadstring("Player:LoadCharacter()")()

If so please let me know :smiley:

May I ask what your trying to achieve?

Running scripts directly through an AnimationTrack.

Why do you need a loadstring to do that?

@jamie1003366 I dont often use loadstrings but it says here on the dev hub that loadstrings load lua code from a string then return it as a function, with that logic youlldefinitely be able to run functions obviously, but I dont think you can parse your variables in the same script though

Did the code above on your original post execute at all?

Apparentely using global variables or _G does work in that matter, I discovered that 2 minutes after making this post, which is awkward since I should’ve researched more before making a post here. Sorry for the incovinience.

1 Like

@jamie1003366 I searched this up on google and found an article that maybe be of use to you

How to loadstring()? | Lua Community Forum.

1 Like