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 » Scripters
Home Search
 

Re: Script can't find children...?

Previous Thread :: Next Thread 
TisfatDude0704 is not online. TisfatDude0704
Joined: 14 Sep 2012
Total Posts: 235
16 Jul 2015 06:37 PM
I'm trying to make a subway through a dialog. The sandwiches (just breads) are in the ReplicatedStorage, and when you talk to the dialog it will clone the sandwich in the replicatedstorage and then have their parent moved to workspace. After that, I try to put the cheese, so I put in the script:

local a = game.Workspace["6InchSandwich"]
script.Parent.DialogChoiceSelected:connect(function(player, choice)
if (choice == script.Parent.Choice1) then
a.MozzarellaCheese.Transparency = 0
end
if (choice == script.Parent.Choice2) then
a.CheddarCheese.Transparency = 0
end
if (choice == script.Parent.Choice3) then
a.SwissCheese.Transparency = 0
end
end)

But, about this line: "local a = game.Workspace["6InchSandwich"]", the script cannot find the 6InchSandwich in Workspace. I am SURE the sandwich is in the Workspace. While I was playing solo I could see the game explorer. But still, the script cannot find it. Please help!
Report Abuse
iamarobloxfan is not online. iamarobloxfan
Joined: 30 Sep 2011
Total Posts: 2343
16 Jul 2015 06:40 PM
Have you tried
local a = game.Workspace.6InchSandwich

OT's Opinions are pineapples to me.
Report Abuse
TisfatDude0704 is not online. TisfatDude0704
Joined: 14 Sep 2012
Total Posts: 235
16 Jul 2015 06:43 PM
...
Are you an idiot?
Report Abuse
Yamaoka is not online. Yamaoka
Joined: 08 Aug 2008
Total Posts: 26
16 Jul 2015 06:44 PM
local a = game.Workspace["6InchSandwich"]
Report Abuse
baldo46 is not online. baldo46
Joined: 28 Jul 2008
Total Posts: 1254
16 Jul 2015 06:45 PM
local a = workspace:FindFirstChild("6InchSandwich");
local sp = script.Parent;
print("a:", a);

local switch = {
[sp.Choice1] = a.MozzarellaCheese,
[sp.Choice2] = a.CheddarCheese,
[sp.Choice3] = a.SwissCheese
}

sp.DialogChoiceSelected:connect(function(plr, choice)
switch[choice].Transparency = 0
end)



if it prints nil, you have a problem and might want to use WaitForChild otherwise there is a naming error.
Report Abuse
iamarobloxfan is not online. iamarobloxfan
Joined: 30 Sep 2011
Total Posts: 2343
16 Jul 2015 06:48 PM
Don't be rude, I'm just trying to help.

OT's Opinions are pineapples to me.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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