BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 18 Sep 2013 06:15 PM |
I am having to rename a spawned model to have a certain name and then add the Player's name after it. I have gotten this to work correctly, but in order to avoid confusion in scripts, I need it to be able to use a String Value as an Object Path, but this doesn't seem to be possible as far as I know.
Is it possible to make something like this work?
What I have so far:
Script 1:
script.Parent.Parent.vehiclePath.Value = ("game.Workspace."..script.Parent.Parent.vehicleName..game.Players.LocalPlayer.Name) ----------------------------------------------------------------------------------------------------------------------------- Script 2
workspace.CurrentCamera.CameraSubject = script.Parent.vehiclePath.Value
Thanks for any help, -Bogy |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 18 Sep 2013 06:34 PM |
| Help Please? I would really appreciate it! :) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Sep 2013 06:35 PM |
Obviously not. You can't change your camerasubject to a string. |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 18 Sep 2013 06:38 PM |
| Yes, I know. But I was wondering if there was a way of doing anything similar (like have the Object Path link to any sort of a Global Variable (Object Values, maybe? Not sure how to use them yet)) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Sep 2013 06:39 PM |
ObjectPath[String]
Like
StringValue = "Part" game.Workspace[StringValue]:Destroy() |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 18 Sep 2013 06:42 PM |
| Okay. Also, one question. I know what Parentheses are used for, I use them all the time. But, what exactly are Brackets ( [ ] ) used for? |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 18 Sep 2013 06:43 PM |
| Brackets are used for indexing |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 18 Sep 2013 06:44 PM |
| Okay, thanks, I appreciate the help! :D |
|
|
| Report Abuse |
|
|
|
| 18 Sep 2013 07:04 PM |
Loadstring
workspace.CurrentCamera.CameraSubject = loadstring("return " .. script.Parent.vehiclePath.Value)() |
|
|
| Report Abuse |
|
|