|
| 29 Jun 2013 10:26 AM |
Im trying to put a script inside the part. so here is my script
local parent = Workspace.Part
function ontouch(part) Parent.Transparency = 1 wait(.1) Parent.CanCollide = true wait(2) Parent.Transparency = 0 wait(.1) Parent.CanCollide =false wait(1) end
Im trying to make it so when the transparency isn't visible cancollide is true. But it isnt working! Help. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 29 Jun 2013 10:28 AM |
ROBLOX is case-sensitive. You called your variable 'parent', then tried changing the properties of 'Parent', which doesn't exist.
Also, you need a connection line. Since you use waits in this function, I also recommend adding a debounce. http://wiki.roblox.com/index.php/Debounce |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 29 Jun 2013 10:29 AM |
Sorry. Here's a link that will help you with your connection line using the .Touched event.
http://wiki.roblox.com/index.php/Touched_(Event) |
|
|
| Report Abuse |
|
|
| |
|
|
| 29 Jun 2013 10:32 AM |
| It says that the page is down... |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 29 Jun 2013 11:03 AM |
You know.. People have been telling me that, lately.. .-. http://wiki.roblox.com/index.php/Touched
If that doesn't work, go to wiki.roblox.com and use the search bar. Type in Touched and press 'go', and it will bring you right to the page. Same with Debounce. If there's no page under that name, it will give you search results with similar names or names that contain similar words. |
|
|
| Report Abuse |
|
|
pudinrox
|
  |
| Joined: 30 May 2010 |
| Total Posts: 2358 |
|
|
| 29 Jun 2013 11:08 AM |
Touched example is like this: Workspace.Part.Touched:connect(function(otherPart) print(otherPart) end) |
|
|
| Report Abuse |
|
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
baheeg
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 72846 |
|
| |
|
Hergest
|
  |
| Joined: 17 May 2011 |
| Total Posts: 309 |
|
|
| 29 Jun 2013 12:39 PM |
A function can be called everything.
It could be function Food(part)
Read the wiki very good. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 29 Jun 2013 12:55 PM |
Because there are waits, you need a debounce.
parent = script.Parent db = false
function ot(h) if db or not game.Players:GetPlayerFromCharacter(h.Parent) then return end db = true parent.Transparency = 1 wait(.1) parent.CanCollide = true wait(2) parent.Transparency = 0 wait(.1) parent.CanCollide =false wait(1) db = false end
parent.Touched:connect(ot) |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 01:02 PM |
script.Parent.Touched:connect(function(hit) script.Parent.Transparency = 1 wait(.1) script.Parent.CanCollide = true wait(2) script.Parent.Transparency = 0 wait(.1) script.Parent.CanCollide = false wait(1) end
--if you put the script into the part you can simply do the above script. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 29 Jun 2013 01:47 PM |
| Once again, it won't work as he wants it to unless you add a debounce. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 01:50 PM |
Ah, right. You're correct.
working = false script.Parent.Touched:connect(function(hit) if working == false then working = true script.Parent.Transparency = 1 wait(.1) script.Parent.CanCollide = true wait(2) script.Parent.Transparency = 0 wait(.1) script.Parent.CanCollide = false wait(1) working = false end end |
|
|
| Report Abuse |
|
|