ReallyExpensive
New Member
Expensive#8553
Posts: 6
ROBLOX Username: ReallyExpensive
|
Admin
Jun 3, 2017 0:17:37 GMT
Post by ReallyExpensive on Jun 3, 2017 0:17:37 GMT
Been working a few hours on an admin script- and I've been on the scripters.cf discord and so far no one can help me with this problem.
I'm trying to make a command where I can do this:
Expensive: :script print("hi")
>hi
I've tried using loadstring:
#code loadstring(txt:sub(4))()
txt:sub(4) is what's after :s
Anybody know a different way to approach and solve my problem?
Thanks,
Expensive!
|
|
|
Admin
Jun 3, 2017 15:29:50 GMT
via mobile
Post by Josh on Jun 3, 2017 15:29:50 GMT
string.sub(str, 4) returns all characters after the fourth in str. So you need to check that the first 8 characters are ":script " and then run everything after that. Make sure that you have LoadstringEnabled set to true.
For example:
if str:sub(1, 8) == ":script " then loadstring(str:sub(9)) end
1, 8 being the first 8 characters.
|
|