|
| 24 Nov 2012 03:14 AM |
function onClicked() script.Parent.Transparency=0.5 if script.Parent.Transparency==0.5 then while wait() do script.Parent.Mesh.Offset = Vector3.new(0,(script.Parent.Mesh.Offset.Y -0.1) , 0) wait(17) script.Parent.Mesh.Offset.Y= 1 script.Parent.Transparency=1 end end end
script.Parent.Parent.Click.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2012 03:17 AM |
So, I want the offset to move down, then after 17 seconds, reset to normal (Invisible, offeset = 1) |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Nov 2012 03:20 AM |
| None. It just doesn't work. |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2012 03:23 AM |
for i = 1,85 do script.Parent.Mesh.Offset = Vector3.new(0,0, 0) - i/10 wait(.2) end
|
|
|
| Report Abuse |
|
|
|
| 24 Nov 2012 03:23 AM |
woops sorry
for i = 1,85 do script.Parent.Mesh.Offset = Vector3.new(0,0, 0) - Vector3.new(0,i/10,0) wait(.2) end |
|
|
| Report Abuse |
|
|
sycips
|
  |
| Joined: 21 Mar 2011 |
| Total Posts: 1368 |
|
|
| 24 Nov 2012 03:25 AM |
| The y axe of the offset is readable ONLY! So you have to think of a way to change the y without doing this offset.y = |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2012 03:28 AM |
function onClicked() script.Parent.Transparency=0.5 local startTime = tick() repeat script.Parent.Mesh.Offset = script.Parent.Mesh.Offset - Vector3.new(0,0.1,0) wait(0.1) until (tick()-startTime) >= 17 --(tick()-startTime) will give you the number of seconds passed since the start of the loop. script.Parent.Mesh.Offset = script.Parent.Mesh.Offset(0,1,0) script.Parent.Transparency=1 end end end
script.Parent.Parent.Click.ClickDetector.MouseClick:connect(onClicked)
--[[ Note: I didn't need to use tick(), there were other ways it could have been done. It's just that this way, you can adjust how fast it moves without worrying about calculations.
tick() returns the time in UNIX time (seconds since the Unix epoch). It has been a long time since then, but it doesn't matter.
Also note that you can only READ the value of the mesh's Offset. Just like the Position in a Part.
print(mesh.Offset.Y) > Valid because you are only looking at the value. mesh.Offset.Y = 1 > Invalid because you tried to change a read only value. mesh.Offset = Vector3.new(0,0,0) > Valid because you changed the Offset itself, not the read only value. |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2012 03:29 AM |
function onClicked() script.Parent.Transparency=0.5 local startTime = tick() repeat script.Parent.Mesh.Offset = script.Parent.Mesh.Offset - Vector3.new(0,0.1,0) wait(0.1) until (tick()-startTime) >= 17 --(tick()-startTime) will give you the number of seconds passed since the start of the loop. script.Parent.Mesh.Offset = script.Parent.Mesh.Offset(0,1,0) script.Parent.Transparency=1 end
script.Parent.Parent.Click.ClickDetector.MouseClick:connect(onClicked)
--Whoops, did one too many ends. Not to mention I was too slow :c |
|
|
| Report Abuse |
|
|
| |
|
|
| 24 Nov 2012 03:33 AM |
| I used FreeToTake's Method. :D |
|
|
| Report Abuse |
|
|