generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Script Builder I am working on.

Previous Thread :: Next Thread 
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 04:18 PM
game.Players.ChildAdded:connect(function(plyr)
plyr.Chatted:connect(function(msg)
if string.sub(string.lower(msg),1,2) == "c/" then
local script = script.ServerSource:Clone()
script.Parent = Workspace
script.Name = plyr.."'s".."ServersideSource"
script.String.Value = string.sub(msg, 3, #msg)
script.Disabled = false
end
end)
end)

I can not check for output. It is not that many lines, whats wrong here?
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
27 Dec 2012 04:19 PM
Could be way easier! we have loadstring dude.


game.Players.ChildAdded:connect(function(plyr)
plyr.Chatted:connect(function(msg)
if (msg:sub(1,2)=="c/") then
loadstring(msg:sub(5))()
end
end)
end)
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 04:22 PM
I like mine better, its gonna be easier to output my way. :o
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
27 Dec 2012 04:23 PM
I already made an error monitoring system, it's fairly easy but the problem is it doesn't detect the errors really good..

like it will detect if I say "script/d" but not if I say something absolutely wrong like:

"script/game.Wokspace.brick:Destroy()"
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 04:24 PM
@ninja. Bad idea. If you will do something like

c/I like carrots

Whole script will break, so that's why you should have different script where you'll load that code.
Report Abuse
ninja5566 is not online. ninja5566
Joined: 14 Jan 2009
Total Posts: 5233
27 Dec 2012 04:25 PM
@zars15


game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(Message)
if (Message:sub(1,7)=="script/") then
local s, err = loadstring(Message:sub(8)) -- Checks for an error, if there is an erorr, set err to it.
if err then -- If there is an error
a = game.Lighting.ErrorGui:clone()
a.Parent = player.PlayerGui
a.Frame.TextLabel.Text = tostring(err) -- Make sure the TextLabel, and Frame have sizes
game.Debris:AddItem(a,2) -- Much better
else -- Guess there's no error, let's fire the loadstring,
s()
end
end
end) end)
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 04:44 PM
Okay, but how about having need for several scripts that uses loops.
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 04:49 PM
game.Players.PlayerAdded:connect(function(plyr)
plyr.Chatted:connect(function(msg)
if msg:lower():sub(1,7) == "script/" then
local s, err = loadstring(Message:sub(8))
-- if err make error gui or watever
else
--theres no error so!
nup = s()
herp = script.ServersideScript:Clone()
herp.Parent = game.Workspace
herp.Source = nup
herp.Disabled = false
end
end
end)
end)

zars this dose not work correctly, this is my first use of string manipulation. Mind correcting it please.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 04:55 PM
If I recall correctly, you still can't use Source property of script, or did they allowed it in recent past? Idk. Way I did it on my script builder, was making other script that's code was something like:

loadstring(script.Src.Value)()


And Src was string value placed in it.


So you should put code in Src variable.
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 04:56 PM
zars, source is the scripts name. xD
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 04:57 PM
Sorry, for not specifying.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 05:00 PM
Hhmmm... In studio Source property worked, but I doubt if it works in online. Might try. Maybe they have unlocked it for us to use now.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 05:02 PM
Anyway if "Source" is script then, you can't make script equal to whatever s() function returns.


Also, since scripts has property Source, it might conflict with that what you was trying to do.
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 05:02 PM
Mind just debugging the script for me? I cant see output because I have to test in play mode. :c
Report Abuse
MainDirectory is not online. MainDirectory
Joined: 20 Dec 2012
Total Posts: 1834
27 Dec 2012 05:55 PM
Tried itterating your guys stuff into it, it still dose not work. :c



game.Players.PlayerAdded:connect(function(plyr)
plyr.Chatted:connect(function(msg)
if msg:lower():sub(1,7) == "script/" then
local s, err = loadstring(Message:sub(8)) ()
-- if err make error gui or watever note to remember to make error gui xD
else
--theres no error so! other note :c
nup = msg:sub(8)
script.ServersideScript.Source.Value = nup
herp = script.ServersideScript:Clone()
herp.Parent = game.Workspace
herp.Disabled = false
end
end)
end)



Make it work plox :c

Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
27 Dec 2012 05:57 PM
no, no, no, you all are doing it wrong.

if you use loadstring the script can maliciously access anything in your script's environment.

there's two solutions to this.
a). use setfenv()
b). run the source code in a different script

¬ LuaLearners Elite/Writer
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
27 Dec 2012 05:58 PM
UHHMMM.... if msg is "script/" then load message, else put it in script? I think that's because you've commented out something and forgot to check other stuff..



game.Players.PlayerAdded:connect(function(plyr)
plyr.Chatted:connect(function(msg)
if msg:lower():sub(1,7) == "script/" then
local s, err = loadstring(Message:sub(8)) ()
-- if err make error gui or watever note to remember to make error gui xD
--else
--theres no error so! other note :c
nup = msg:sub(8)
script.ServersideScript.Source.Value = nup
herp = script.ServersideScript:Clone()
herp.Parent = game.Workspace
herp.Disabled = false
end
end)
end)
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
27 Dec 2012 05:59 PM
additionally, your script only catches compile errors, not run-time errors.

¬ LuaLearners Elite/Writer
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
27 Dec 2012 06:23 PM
I remember there being a script builder example on the wiki. I'll go look in my history for it.

-~Obly of C&G~-
Report Abuse
GhostSailor is not online. GhostSailor
Joined: 02 Jul 2010
Total Posts: 1913
27 Dec 2012 06:26 PM
Okay, it wasn't what I was looking for, but it would help you guys.

http://wiki.roblox.com/index.php/Sandboxing

The example was edited out, I believe.

-~Obly of C&G~-
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
27 Dec 2012 06:56 PM
i actually borrowed that snippet and marked it up a bit in my script builder.

¬ LuaLearners Elite/Writer
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image