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 » Scripters
Home Search
 

Re: simple script wont work?

Previous Thread :: Next Thread 
Biost is not online. Biost
Joined: 25 Sep 2014
Total Posts: 3922
11 Nov 2014 03:16 PM
door = game.Workspace.door


function open()
wait(0.1)
door.Mesh.Offset = Vector3.new(0, 0, 0.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.5)
door.CanCollide = false
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6.75)
wait()
toggle = true
debounce = false
end
function close()
wait(0.1)
door.Mesh.Offset = Vector3.new(0, 0, 6.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 6)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 4)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.5)
door.CanCollide = true
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 3)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 2)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 1)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.75)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0)
wait()
toggle = false
debounce = false
end
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
if key == "e" then
connect:open()
end


What might I be doing wrongista? Thanks,
Report Abuse
Biost is not online. Biost
Joined: 25 Sep 2014
Total Posts: 3922
11 Nov 2014 03:24 PM
b1
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
11 Nov 2014 03:36 PM
Your doing everything wrong. EVERYTHING!
Report Abuse
Biost is not online. Biost
Joined: 25 Sep 2014
Total Posts: 3922
11 Nov 2014 03:40 PM
Alright well this is one of my first scripts ever, so mind instead of telling me im bad help me out?

Thanks man.
Report Abuse
builderman0621 is not online. builderman0621
Joined: 13 Jul 2010
Total Posts: 1612
11 Nov 2014 04:14 PM
lrn2loop
Report Abuse
imaminer99 is not online. imaminer99
Joined: 01 Feb 2011
Total Posts: 894
11 Nov 2014 04:20 PM
This belongs in Scripting Helpers
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
11 Nov 2014 04:46 PM
In the future, please post help requests to this forum: http://www.roblox.com/Forum/ShowForum.aspx?ForumID=20

So, as someone earlier mentioned, you should probably be using a loop for this action. Here's the roblox wiki page for loops: http://wiki.roblox.com/index.php?title=Loop

You can usually use any loop you feel like, but for this case let's use a for loop.

When you have code like this:
door.Mesh.Offset = Vector3.new(0, 0, 0.25)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.5)
wait()
door.Mesh.Offset = Vector3.new(0, 0, 0.75)
wait()

It is easy to find what you want to be looping.

The for loop is set up in the following way:
for i = STARTNUM, ENDNUM[, INCREMENT] do
STATEMENTS
end

The increment is optional, but useful in this case.
So, to convert the code into a loop, you would find the pattern and place it into the loop.

for i = 0, 3.5, 0.25 do
door.Mesh.Offset = Vector3.new(0,0,i)
wait()
end

At this point, you wanted to change the value of the cancollide property. You could put an if statement to check if i was a certain value, but I would suggest ending the loop there and adding the code. After that, you can make another loop

for i = 3.5, 6.25, 0.25 do
STATEMENTS
end

Similarly, for the close function, you can write:
for i = 6.75, 0, -0.25 do
door.Mesh.Offset = Vector3.new(0,0,i)
wait()
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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