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: Help!

Previous Thread :: Next Thread 
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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
FertileTurtle is not online. FertileTurtle
Joined: 04 Dec 2012
Total Posts: 1414
24 Jul 2014 01:29 PM
You can only used .Touched on parts, not models.

I like turtles.
Report Abuse
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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
InfamousGorillas is not online. InfamousGorillas
Joined: 22 Apr 2014
Total Posts: 52
24 Jul 2014 01:42 PM
kid do u even know how to script

Report Abuse
alij12 is not online. 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 is not online. 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 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
24 Jul 2014 02:02 PM
It now says its something with
Brick.Transparency = 1
Sorry im really new to Lua
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
24 Jul 2014 02:02 PM
you dont define brick

Report Abuse
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
24 Jul 2014 02:04 PM
Changed it to "Model" still wont work
Report Abuse
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
24 Jul 2014 02:12 PM
Help!
Report Abuse
maxomega3 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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 is not online. 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 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
24 Jul 2014 02:31 PM
Got it. Now it says touched is not part of workspace '_' Now what?
Report Abuse
maxomega3 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
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 is not online. 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
Tonyvongthong5 is not online. Tonyvongthong5
Joined: 19 Feb 2012
Total Posts: 232
24 Jul 2014 02:49 PM
No errors now. But it wont work. Ughh
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
24 Jul 2014 02:51 PM
The part in Workspace won't turn invisible?
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