Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there anyway for varibles to be a command like this... ?

Asked by 3 years ago
Edited 3 years ago

im pretty new... So i am trying to make variables that certain parts can vary, combine them and execute them is there anyway I can do this.

local text = "pp small"
local a = "pri"
local b = "nt("..text..")"

loadstring(a..b,true)

something like that u know, I don't know if this makes sense or is just a dumb question but... or like this.

local ______ = require(blah blah,"blahblah") -- this thing can vary depends on playyer
local __ = game.Replicastore.RemoteEvent -- this thing varies the remoteeven could be abc 
local together = __:FireServer(..______..)

loadstring(together,true) -- combine the variable and execute them keep in mind require can vary

HALP ME HALP ME HALP ME

2 answers

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

For your first question yes you can do it like that but the code you provided doesnt work

Here is the modified version, which works

local text = "pp small"
local a = "pri"
local b = "nt('"..text.."')"

loadstring(a..b)()

But you shouldnt use loadstring at all, there is no reason to use it

Ad
Log in to vote
-1
Answered by 3 years ago

You could use local function, for example:

local function HI()
    print("Hello")
end
-- You can call it by
HI()

(Output:

Hello 

)

Answer this question