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: I posted this yesterday but i cant find the thread...

Previous Thread :: Next Thread 
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 03:51 PM
so im asking again:

what is wrong with my script?


local c = game.Lighting.Stores.Stores:GetChildren()
for i = 1, #c do
local f = game.Teams:GetChildren()
for i = 1, #f do
if f[i].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and
c[i].Name == f[i].Name then
local k = game.Workspace:GetChildren()
for i = 1, #k do
if k[i].Name == c[i].Name then
c[i].LemonadeStand.Parent = k[i]
end
end
end
end
end

this is just part of it here is the output:

Players.Player.PlayerGui.ScreenGui.Frame.LemonadeStand.Scri:18: attempt to index field '?' (a nil value)
Script "Players.Player.PlayerGui.ScreenGui.Frame.LemonadeStand.Scri", Line 18
stack end
Disconnected event because of exception
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
10 Sep 2011 03:52 PM
What's like 18...? :/


-Like an __AWESOME__ boss
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 03:53 PM
oops i was going to post that sorry line 18 is this one "c[i].Name == f[i].Name then"
Report Abuse
Dyvoliox is not online. Dyvoliox
Joined: 08 Sep 2011
Total Posts: 28
10 Sep 2011 03:55 PM
if c[i].Name == f[i].Name then
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
10 Sep 2011 03:56 PM
Okay, well, the problem is that you are overwriting i.

local c = game.Lighting.Stores.Stores:GetChildren()
for i = 1, #c do
local f = game.Teams:GetChildren()
for x = 1, #f do
if f[x].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and
c[i].Name == f[x].Name then
local k = game.Workspace:GetChildren()
for z = 1, #k do
if k[z].Name == c[i].Name then
c[i].LemonadeStand.Parent = k[z]
end
end
end
end
end

Then, on line 18. change f[i] to f[x]


-Like an __AWESOME__ boss
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 03:59 PM
thanks electric
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
10 Sep 2011 04:00 PM
No problem.


-Like an __AWESOME__ boss
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 04:02 PM
ok now it doesn't say anything in the output but it wont bring the lemonade stand into the Workspace form the lighting like it is supposed to towards the end of the script.
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 04:13 PM
knowone knows the answere? should i post the whole script?


function onButtonClicked()

script.Parent.Parent.Parent.Money.TextBox.Value.Value = script.Parent.Parent.Parent.Money.TextBox.Value.Value - 10

local c = game.Lighting.Stores.Stores:GetChildren()
for i = 1, #c do
local f = game.Teams:GetChildren()
for x = 1, #f do
if f[x].TeamColor == script.Parent.Parent.Parent.Parent.Parent.TeamColor and
c[i].Name == f[x].Name then
local k = game.Workspace:GetChildren()
for z = 1, #k do
if k[z].Name == c[i].Name then
c[i].LemonadeStand.Parent = k[z]

end
end
end
end
end



script.Parent.Active = false

end

script.Parent.MouseButton1Click:connect(onButtonClicked)
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 04:22 PM
i guess no one knows
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
10 Sep 2011 04:24 PM
Y U USE 'i' TWICE?
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 04:26 PM
ya electric fixed that for me so that fixed one of the problems but there is still another that the output cant detect
Report Abuse
Cachinnation is not online. Cachinnation
Joined: 21 Aug 2011
Total Posts: 1797
10 Sep 2011 04:31 PM
You didn't clone it..?
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 04:53 PM
no should i of?
Report Abuse
rpg877 is not online. rpg877
Joined: 14 Sep 2008
Total Posts: 447
10 Sep 2011 05:18 PM
ok i changed the script to this:



local LemonadeStand = game.Workspace.Red1.LemonadeStand:Clone()
game.Workspace.Red1.LemonadeStand:Remove()

function onButtonClicked()

local c = game.Workspace.Red1:GetChildren()
for i = 1, #c do
c[i]:Remove()

local lemon = LemonadeStand:Clone()
lemon.Parent = game.Workspace.Red1
end

end

script.Parent.MouseButton1Click:connect(onButtonClicked)




it removes the lemonade stand on line 2 when i run the script but when i click the gui it doesnt do anything.
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