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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: LocalScript Script Builder Woes.

Previous Thread :: Next Thread 
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
24 Jan 2013 03:51 PM
I've been working on a script builder for the past day or so and I've found a problem; normal scripts execute just fine and dandy, but LocalScripts appear to not run and without any errors in the output.

Here is the code inside both normal scripts and localscripts:

local Script = loadstring(script.SourceValue.Value)
Script()


Here is the code of the SB itself:

game.Players.PlayerAdded:connect(function(Player)
local Scripts = {}
Player.Chatted:connect(function(Message)
local MessageLower = string.lower(Message) -- string lowered version of message
if string.sub(MessageLower,1,2) == "s/" then -- script
local Text = string.sub(Message,3)
local NewScript = script.Script:Clone()
local TextValue = Instance.new("StringValue",NewScript)
TextValue.Name = "SourceValue"
TextValue.Value = Text
NewScript.Disabled = false
NewScript.Parent = game.Workspace
NewScript.Name = Player.Name.."'s Script"
table.insert(Scripts, 1,NewScript)
end

if string.sub(MessageLower,1,2) == "l/" then -- localscript
local Text = string.sub(Message,3)
local NewScript = script.LocalScript:Clone()
local TextValue = Instance.new("StringValue",NewScript)
TextValue.Name = "SourceValue"
TextValue.Value = Text
NewScript.Disabled = false
NewScript.Parent = Player.Character -- local place
NewScript.Name = Player.Name.."'s Script"
table.insert(Scripts, 1,NewScript)
end

if MessageLower == "clear" then
for i = 1, #Scripts do
local Removee = Scripts[i]
Removee.Disabled = true
Removee:Remove()
end
end
end)
end)


Why is this so?
Report Abuse
jrf2112 is not online. jrf2112
Joined: 29 Jun 2008
Total Posts: 3354
24 Jan 2013 04:27 PM
You can't spawn a localscript. You can emulate scripts, but you can't change the source of programs.
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
24 Jan 2013 04:34 PM
@Jr
What?
I'm not changing the source at all here, merely using loadstring.
Report Abuse
jrf2112 is not online. jrf2112
Joined: 29 Jun 2008
Total Posts: 3354
24 Jan 2013 04:38 PM
You asked why is this so. I answered.


Loadstring doesn't work like that, then.
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
24 Jan 2013 06:55 PM
Darn. How do other Script Builders handle local scripts then?
Report Abuse
RenderSettings is not online. RenderSettings
Joined: 16 Aug 2010
Total Posts: 2560
24 Jan 2013 06:56 PM
Ignore him, that is exactly how Loadstring works. I think the problem is an obscere bug with LocalScripts: If you clone a Localscript that already ran, the clone will never run (or something along those lines). Try Cloning the clone of a localscript in Lighting.
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
24 Jan 2013 06:58 PM
And the adventure continues!

( The 'Base' scripts as you will are disabled, but I will however try this in lighting with clones of clones! )
Report Abuse
popdosprlte is not online. popdosprlte
Joined: 18 Dec 2009
Total Posts: 4801
24 Jan 2013 07:07 PM
Tried your edits to my code, didn't work anyhow. LocalScripts still won't launch, but normal scripts work just dandy.
( Test Trial was one normal script, 1 local scripts and then 1 normal scripts. Both normal scripts functioned just fine, but the localscript didn't fire, and had no error. )

game.Players.PlayerAdded:connect(function(Player)
local Scripts = {}
Player.Chatted:connect(function(Message)
local MessageLower = string.lower(Message) -- string lowered version of message
if string.sub(MessageLower,1,2) == "s/" then -- script
local Text = string.sub(Message,3)
local NewScript = game.Lighting.Script:Clone()
local TextValue = Instance.new("StringValue",NewScript)
TextValue.Name = "SourceValue"
TextValue.Value = Text
NewScript.Disabled = false
NewScript.Parent = game.Workspace
NewScript.Name = Player.Name.."'s Script"
table.insert(Scripts, 1,NewScript)
end

if string.sub(MessageLower,1,2) == "l/" then -- localscript
local Text = string.sub(Message,3)
local OldScript = game.Lighting.LocalScript:Clone() -- test stuff
OldScript.Disabled = true
local NewScript = OldScript:Clone()
NewScript.Disabled = true
local TextValue = Instance.new("StringValue",NewScript)
TextValue.Name = "SourceValue"
TextValue.Value = Text
NewScript.Parent = Player.Character -- local place
NewScript.Disabled = false
NewScript.Name = Player.Name.."'s Script"
table.insert(Scripts, 1,NewScript)
end

if MessageLower == "clear" then
for i = 1, #Scripts do
local Removee = Scripts[i]
Removee.Disabled = true
Removee:Remove()
end
end
end)
end)
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