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: First Script

Previous Thread :: Next Thread 
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 01:36 PM
a = 2
b = 3
c = b-a
if c== -1 then
for i=1,10 do
print("Hate you")
end
elseif c== 1 then
for i=1,20 do
print("Love you")
end
end

This is my first script, is there anything I could do easier? Also, can anyone give me something harder to do so I can test my skills.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 01:40 PM
Make a script that continuesly rotates a part 100 times, rotating 90 degrees every 5 seconds.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 01:57 PM
--Made by Trade

B = Workspace.Part


B.CFrame = CFrame.new(0,1.2,0) *CFrame.Angles(0,math.pi,0)


Can't seem to get any further...
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 01:59 PM
--Made by TradeLife, edited by warspyking

Part = Workspace.Part

for I = 1,100 do wait(5)
Part.CFrame = Part.CFrame * CFrame.Angles(0, 0, math.rad(90))
end
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:01 PM
Still only rotates once per 5 seconds :/.
Report Abuse
BusyCityGuy is not online. BusyCityGuy
Joined: 17 Aug 2012
Total Posts: 2144
17 Jun 2014 02:02 PM
Duh... there is a wait(5) in there. :P What would you expect e.e

-The [Guy]
Report Abuse
badfitz99 is not online. badfitz99
Joined: 01 May 2010
Total Posts: 5854
17 Jun 2014 02:02 PM
@trade

change wait(5) to how long till it rotates it again

-- The scripter of Off-Topic -- ill gnaw ur arm off hagrid!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 02:03 PM
"Make a script that continuesly rotates a part 100 times, rotating 90 degrees every 5 seconds."


It was supposed to.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:04 PM
Well I only said that because he said 100 times per 5 seconds, not sure if you can do that
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:04 PM
OHH, 100 times in total, I thought you meant 100 times per 5 seconds. I could do that :P.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 02:15 PM
Alright then. Now make a function that changes the Transparency property of every part in a model (the model ONLY has parts in it)
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:22 PM
-- Made by Trade

a= Workspace.Model.a
b= Workspace.Model.b
c= Workspace.Model.c
d= Workspace.Model.d

a.Transparency = 1
b.Transparency = 1
c.Transparency = 1
d.Transparency = 1

No idea how to simplify.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:29 PM
-- Made by Trade

a= Workspace.Model


a.a.Transparency = 1
a.b.Transparency = 1
a.c.Transparency = 1
a.d.Transparency = 1

Shortened to that.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
17 Jun 2014 02:34 PM
:getChildren () creates a table of all the elements inside a model.

for i,v in pairs () do is a loop that processes each item in a table separately.
(Note: i and v are both variables that you can rename to whatever)

a = Workspace.Model:GetChildren ()

for i,member (a) do
member.Transparency = 1
end
Report Abuse
sonicdiablo is not online. sonicdiablo
Joined: 05 Feb 2009
Total Posts: 1661
17 Jun 2014 02:36 PM
"every part in a model"

He wants you to use the :GetChildren() method to get a table of all the childs in the model, and change the transparency to all the childs that are parts to 1.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 02:43 PM
Max that doesn't seem to work, it keeps saying attempt to call a table value.
Report Abuse
sonicdiablo is not online. sonicdiablo
Joined: 05 Feb 2009
Total Posts: 1661
17 Jun 2014 02:43 PM
Though, tradelife, here's a way to simplify what you wrote even more:

a = script.Parent
a.a.Transparency,a.b.Transparency,a.c.Transparency=1,1,1
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 03:09 PM
For _,v in ipairs(Workspace.Model:GetChildren()) do
if v:IsA("BasePart") then --Safety XD
v.Transparency = 1
end
end
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 03:16 PM
I don't understand any of that.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 03:20 PM
Does anyone know any advanced tutorials?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 03:20 PM
for _,v in ipairs(Workspace.Model:GetChildren()) do --For every object in Workspace.Model do
if v:IsA("BasePart") then --Check if it is a type of Part
v.Transparency = 1 --Change the Transparency
end --End
end --End
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 03:21 PM
Thanks!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 03:25 PM
No problem.

Now try making a script that will make a brick move up and down at a rate of 1 stud per second, make it go up 20 studs before coming back down and repeating.
Report Abuse
TradeLife is not online. TradeLife
Joined: 05 May 2013
Total Posts: 376
17 Jun 2014 03:51 PM
--Made by Trade

p = Workspace.Part

for i=1, 20 do
p.CFrame = CFrame.new(0,i,0)
wait(1)
end
for i=1, 20 do
p.CFrame = CFrame.new(0,20-i,0)
wait(1)

end

Got it to go up and down but how do I loop it?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
17 Jun 2014 03:56 PM
--Made by TradeLife, edited by warspyking

p = Workspace.Part

while true do
for i=1, 20 do
p.CFrame = CFrame.new(0,i,0)
wait(1)
end

for i=1, 20 do
p.CFrame = CFrame.new(0,20-i,0)
wait(1)
end
end
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