|
| 24 Jul 2014 01:28 PM |
| Hello im new to Scripting. I have this model (hair) and i want to make it visible/invisible. I did this on a brick and worked. My problem is something is wrong with Model.Touched:connect(onTouch). Any help? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 01:29 PM |
You can only used .Touched on parts, not models.
I like turtles. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 01:32 PM |
I deleted it but i went solo and didnt work. Heres the script
local Model = Workspace
function onTouch(Model) -- The function that runs when the part is touched. brick.Transparency = 1 wait(1) brick.Transparency = 0 end
|
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 24 Jul 2014 01:34 PM |
You have no connection, put this:
model.Part.Touched:connect(onTouch) --change model.Part to the part they have to touch |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 01:41 PM |
So it would be local Model = Workspace
function onTouch(Model) -- The function that runs when the part is touched. brick.Transparency = 1 wait(1) brick.Transparency = 0 end model.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 01:42 PM |
kid do u even know how to script
|
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 24 Jul 2014 01:43 PM |
No, Not model.Touched, you cant touch Workspace.
.Touched ONLY works on BRICKS. So do something like this:
Model.Part.Touched:connect(onTouch)
if you do model.Touched (Its supossed to be Model btw) and you set Model to workspace, it wont work, Also the "onTouch(Model)", change it to "onTouch()" |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 24 Jul 2014 01:44 PM |
| you set model to workspace then said if model is touched, which means you're basically saying if workspace is touched. You have to do workspace.part.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 24 Jul 2014 01:45 PM |
local model = Workspace.Part
function onTouch() brick.Transparency = 1 wait(1) brick.Transparency = 0 end
model.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:02 PM |
It now says its something with Brick.Transparency = 1 Sorry im really new to Lua |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Jul 2014 02:04 PM |
| Changed it to "Model" still wont work |
|
|
| Report Abuse |
|
|
| |
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:15 PM |
| Capitalization is important. Would you mind pasting your current version of the script? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:18 PM |
local Model = Workspace.Part
function onTouch() Model.Transparency = 1 wait(1) Model.Transparency = 0 end
Model.Touched:connect(onTouch) Something is not right -_- |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:21 PM |
Looks fine to me, as long as Workspace.Part refers to an actual Part and not some other instance named Part, it should work.
What does the Output say about it? |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:23 PM |
| Nothing about that. Ok so the model does not have a "part" in it so i change it? It says Touched is invalid member of model |
|
|
| Report Abuse |
|
|
davisky2
|
  |
| Joined: 04 Mar 2012 |
| Total Posts: 4710 |
|
|
| 24 Jul 2014 02:26 PM |
| I think you actualy can touch Workspace, only if it has 1 brick in it |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:29 PM |
| It has to be a Part, since BaseParts are the only things with hitboxes. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:31 PM |
| Got it. Now it says touched is not part of workspace '_' Now what? |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:39 PM |
it has to be a part Workspace is a Service a model named Part is still a model
Make a part named "Part", put it in the Workspace, and you're done. |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:44 PM |
| So i did that. Now it says connect isn't. Then i put a part named connect. Wont work |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:46 PM |
what? No, connect is a method, not an instance.
It should be Workspace.Part.Touched:connect (onTouch) |
|
|
| Report Abuse |
|
|
|
| 24 Jul 2014 02:49 PM |
| No errors now. But it wont work. Ughh |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 24 Jul 2014 02:51 PM |
| The part in Workspace won't turn invisible? |
|
|
| Report Abuse |
|
|