|
| 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 |
|
|
|
| 16 Jul 2015 06:40 PM |
Have you tried local a = game.Workspace.6InchSandwich
OT's Opinions are pineapples to me. |
|
|
| Report Abuse |
|
|
| |
|
Yamaoka
|
  |
| Joined: 08 Aug 2008 |
| Total Posts: 26 |
|
|
| 16 Jul 2015 06:44 PM |
| local a = game.Workspace["6InchSandwich"] |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|