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: What's wrong with THIS?

Previous Thread :: Next Thread 
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
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
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
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
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
24 Nov 2012 03:19 AM
output?
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
24 Nov 2012 03:20 AM
None. It just doesn't work.
Report Abuse
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
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
FreeToTake is not online. FreeToTake
Joined: 21 Apr 2010
Total Posts: 1827
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 is not online. 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
RobustPhysics is not online. RobustPhysics
Joined: 12 Jul 2012
Total Posts: 3064
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
RobustPhysics is not online. RobustPhysics
Joined: 12 Jul 2012
Total Posts: 3064
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
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
24 Nov 2012 03:33 AM
Thanks. It works.
Report Abuse
BlizardAlpha is not online. BlizardAlpha
Joined: 23 Aug 2012
Total Posts: 753
24 Nov 2012 03:33 AM
I used FreeToTake's Method. :D
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