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: Need help with this ADVANCED script.

Previous Thread :: Next Thread 
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
12 Jan 2012 10:59 PM
Hi, I've spent the last 2 hours tinkering with the "edit/" command.

EVERY command works in the script, I just think the message "exit/" or "edit/" is getting added into the StringValue. I can't figure out how to get it to not do that. So, if anybody could help, that would be fantastic.

Look towards the bottom of the script (function edit() and the while true do)

Thanks,
Slayer219


banned = {}
cat = "game.Players."
banworthy = {"game.Workspace:Destroy()", "game.Workspace:Remove()", string.sub(cat,1,13)}

game.Players.PlayerAdded:connect(function(speaker)
repeat wait() until speaker:findFirstChild("PlayerGui")
repeat wait() until speaker.PlayerGui:findFirstChild("Status")
bool = Instance.new("BoolValue")
bool.Parent = speaker
bool.Name = "EditMode"
bool.Value = false
for i = 1, #banned do
if (speaker.Name == banned[i]) then
repeat wait() until speaker
speaker:Destroy()
end
end

speaker.Chatted:connect(function(msg)

function create()
r = Instance.new("StringValue")
r.Parent = speaker
r.Name = string.sub(msg,8)
ru = string.sub(msg,8)
g = speaker:findFirstChild(ru)
speaker.PlayerGui.Status.TextLabel.Text = "Created "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
end

function edit()
b = speaker:findFirstChild("EditMode")
if b then
speaker.PlayerGui.Status.TextLabel.Text = "Now editing "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
b.Value = true
end
end

function run()
pcall(function() loadstring(g.Value)() end)
speaker.PlayerGui.Status.TextLabel.Text = "ran "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
end

function ban()
table.insert(banned, speaker.Name)
speaker:Destroy()
end

if string.sub(msg,1,7) == "create/" then
create()
end

if string.sub(msg,1,5) == "edit/" then
edit()
end

if string.sub(msg,1,4) == "run/" then
run()
end


while true do --This is what I think's the problem
wait()
if (b.Value == true) and (string.sub(msg,1,5) ~= "exit/") then
g.Value = g.Value..msg
elseif msg == "exit/" then
wait()
b.Value = false
end
end


for k = 1, #banworthy do
if msg == banworthy[i] then
table.insert(banned, speaker.Name)
speaker:Destroy()
end
end


end)
end)
Report Abuse
evilspartan9000 is not online. evilspartan9000
Joined: 09 Apr 2010
Total Posts: 10655
12 Jan 2012 11:04 PM
Do you just want to get rid of the messages? I think I could do that
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
12 Jan 2012 11:07 PM
? Elaborate?
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
13 Jan 2012 01:53 AM
Bump
Report Abuse
superpizzamaker is not online. superpizzamaker
Joined: 07 Jul 2010
Total Posts: 4
13 Jan 2012 01:59 AM
Me too :D
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
13 Jan 2012 02:00 AM
^^^^^ Spam much? Get out unless you have something productive to say.
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
13 Jan 2012 10:08 PM
Bump
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
15 Jan 2012 12:29 AM
Bump
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
15 Jan 2012 01:38 AM
Bump
Report Abuse
MrgamesNwatch is not online. MrgamesNwatch
Joined: 02 Feb 2009
Total Posts: 7729
15 Jan 2012 01:56 AM
wouldn't it get stuck on the while loop since you never break it?

~I've been to nil and back.
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
15 Jan 2012 02:35 AM
Bump isn't productive either :O
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
15 Jan 2012 02:38 AM
for k = 1, #banworthy do
if msg == banworthy[i] then
table.insert(banned, speaker.Name)
speaker:Destroy()
end
end

this part will never start, because you made an infinite loop before, so that would never end.
Try switching both so the loop comes at the end.
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
15 Jan 2012 02:40 AM
if (string.sub(msg,1,5) ~= "exit/") then
if (b.Value == true) then
g.Value = g.Value..msg
elseif msg == "exit/" then
wait()
b.Value = false
end
end
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
15 Jan 2012 11:40 AM
I have to say, bumping is quite productive. Without a bump you never would have seen this thread.

Anyway, I still can't get it to work. I think I know how to test it though... I'll get back to you.
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
15 Jan 2012 12:07 PM
Found out what's wrong (after tinkering with the script some more) the exit/ command is no longer working. Let's see what you guys think. I can successfully run one script, but everything after exit/ gets added to the script (run/, create/, etc.).


banned = {}
cat = "game.Players."
banworthy = {"game.Workspace:Destroy()", "game.Workspace:Remove()", string.sub(cat,1,13)}

game.Players.PlayerAdded:connect(function(speaker)
repeat wait() until speaker:findFirstChild("PlayerGui")
repeat wait() until speaker.PlayerGui:findFirstChild("Status")
bool = Instance.new("BoolValue")
bool.Parent = speaker
bool.Name = "EditMode"
bool.Value = false
for i = 1, #banned do
if (speaker.Name == banned[i]) then
repeat wait() until speaker
speaker:Destroy()
end
end

speaker.Chatted:connect(function(msg)

function create()
r = Instance.new("StringValue")
r.Parent = speaker
r.Name = string.sub(msg,8)
ru = string.sub(msg,8)
g = speaker:findFirstChild(ru)
speaker.PlayerGui.Status.TextLabel.Text = "Created "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
end

function edit()
b = speaker:findFirstChild("EditMode")
if b then
speaker.PlayerGui.Status.TextLabel.Text = "Now editing "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
b.Value = true
end
end

function run()
pcall(function() loadstring(g.Value)() end)
speaker.PlayerGui.Status.TextLabel.Text = "ran "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
end

function ban()
table.insert(banned, speaker.Name)
speaker:Destroy()
end

function exit()
if b then
if b.Value == true then
b.Value = false
speaker.PlayerGui.Status.TextLabel.Text = "No Longer Editing "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
end
end
end

for k = 1, #banworthy do
if msg == banworthy[i] then
table.insert(banned, speaker.Name)
speaker:Destroy()
end
end

if string.sub(msg,1,7) == "create/" then
create()
end

if string.sub(msg,1,5) == "edit/" then
edit()
end

if string.sub(msg,1,4) == "run/" then
run()
end

if (string.sub(msg,1,5) ~= "exit/") then
if (string.sub(msg,1,5) ~= "edit/") then
if (b.Value == true) then
g.Value = g.Value..msg
speaker.PlayerGui.Status.TextLabel.Text = "Text added to "..ru
wait(2)
speaker.PlayerGui.Status.TextLabel.Text = " "
elseif msg == "exit/" then
exit()
end
end
end

end)
end)
Report Abuse
slayer219 is not online. slayer219
Joined: 15 Nov 2008
Total Posts: 3445
15 Jan 2012 12:19 PM
Nevermind, I fixed it. Working great. Thanks for the ideas generated here!
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