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: Is This Correct?

Previous Thread :: Next Thread 
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:23 PM
Is this script correct? (my first script so don't criticize)
Function OnTouched

Move (Part) = 0.1 Loop = 50
Wait = 5

end

(same thing but moving it backwards)
Function OnTouched

Move (Part) = -0.1 = Loop 50

end
(read top for info why this might not be correct)


Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:25 PM
bump
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:30 PM
can anyone help me? i want to continue with my nuclear power plant game!
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jul 2014 05:31 PM
No it isn't correct, the first thing I see is
Function

Should be
function

Theres more wrong with it, I'll try and help you but I need you to explain what the script is supposed to do first
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:32 PM
well the words aren't in the -- for this time but its supposed to move a door...
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
15 Jul 2014 05:33 PM
It's a good start!

I think he wants to move a script 50 studs in a direction?
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:33 PM
no i want it to move the brick a tenth of a block 50 times and then move it back a tenth of a block 50 times
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
15 Jul 2014 05:34 PM
http://wiki.roblox.com/Cookbook
Also, capitals matter.
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:36 PM
what do you mean i don't see any doors in the cookbook...
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jul 2014 05:38 PM
The cookbook will help you learn lua

https://www.youtube.com/watch?v=Urvn69ZbM_Y
I suggest watching parts 1 to 10 to learn what you need
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:39 PM
i just want the corrections!
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
15 Jul 2014 05:41 PM
Where do you want the block moved? Up?
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jul 2014 05:42 PM
function Move()
for x = 1, 50 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, 0.1, 0)
wait(5)
end
for x = 1, 50 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0, -0.1, 0)
wait(5)
end
end

Move()
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:43 PM
to the left so i would say X? wait i reverse the script put the top script on the bottom and bottom on the top of its Xa
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:45 PM
so i want a block to move 5 studs but not 1 stud per second i want a tenth of a stud per half second and then it returns for idea i want the door to open move this way <------ then i want it after 5 seconds to move back the same amount it moved <------ but i want it to move ------>
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
15 Jul 2014 05:46 PM
Oh, then edit it.
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:47 PM
edit what parts?
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
15 Jul 2014 05:50 PM
You know, I mean, a beginner scripter would get it, somebody who read and understands the cookbook for example...
Report Abuse
marfit is not online. marfit
Joined: 10 Jan 2013
Total Posts: 2539
15 Jul 2014 05:51 PM
i don't see anything in the cookbook for making a block move!
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
15 Jul 2014 05:54 PM
You dont want to learn to script, okay.
Im not going to make a script for you.
Report Abuse
Ulrakid11 is not online. Ulrakid11
Joined: 31 Dec 2010
Total Posts: 1587
15 Jul 2014 05:59 PM
I'm bored so I'll be nice and write you a basic script. If it doesn't work, too bad.
Here's a good script with comments on how it works. You'll need to group both door parts as a model and name them Door1 and Door2.

local d1 = script.Parent.Parent.Door1
local d2 = script.Parent.Parent.Door2
local open = false --basically this is a variable to detect if it's open or not

function OnTouch(hit) --the start of the function
h = hit.Parent:FindFirstChild("Humanoid") --finds a humanoid in what touched it
if not h or open then return end --if it's open or there's a humanoid it ends
open = true --tells the script it's now open
for x = 1, 50 do --runs the loop 50 times
d1.CFrame = script.Parent.CFrame + Vector3.new(.1,0,0) --assuming they're on the x-axis
d2.CFrame = script.Parent.CFrame + Vector3.new(-.1,0,0)
wait(.5)
end
wait(5)
for x = 1, 50 do --this loop moves it back
d1.CFrame = script.Parent.CFrame + Vector3.new(-.1,0,0)
d2.CFrame = script.Parent.CFrame + Vector3.new(.1,0,0)
wait(.5)
end
end

d1.Touched:connect(onTouch)
d2.Touched:connect(onTouch) --these run the function above if either door is touched

Realize that very rarely in scripting helpers will you get a written script. I simply had a lot of free time.
Report Abuse
Ulrakid11 is not online. Ulrakid11
Joined: 31 Dec 2010
Total Posts: 1587
15 Jul 2014 06:00 PM
After the last wait, add this line:

open = false
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