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: Variable help

Previous Thread :: Next Thread 
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 10:45 PM
I want to understand how to use variables
I know that if i said
X = Torso
That would make X the torso value. But how would i use this in a script? such as
game.Workspace.Player1.X.Transparency = 1
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 10:54 PM
Please some one tell me :c
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
12 Jul 2013 10:56 PM
Lol, you have 69 posts.

And you could just do:

X.Transparency = 1
game.Workspace.Player1[X.Name].Transparency = 1
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 10:59 PM
i dont understand? is X.Transparency = 1 With that bottem one? and if so What is [X.Name] supose to do
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
12 Jul 2013 11:03 PM
X = workspace.Part

X:Destroy()
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
12 Jul 2013 11:05 PM
@dj, they both do the same thing.

You can do a lot with variables. Like this:

variable1 = "Hai"
variable2 = "Bye"
variable3 = ":("


table = {variabel1,variable2,variable3}
for i,v in pairs(table) do
print(v)
end
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
12 Jul 2013 11:08 PM
No offence Zach but concidering he doesn't know how to use basic variables, I don't think giving him tables and stuff is going to help very well.
Report Abuse
ZachBloxx is not online. ZachBloxx
Joined: 26 Jun 2013
Total Posts: 2833
12 Jul 2013 11:11 PM
Yeah probably, but I was just trying to give an example he could try to examine. Even if it's a bit advanced for him.
Report Abuse
clanky4 is not online. clanky4
Joined: 21 Oct 2009
Total Posts: 389
12 Jul 2013 11:12 PM
Variables are just a way to make writing a script shorter.

For instance you could have a relatively long ancestry that you would need to use several times.

local thebagel = Part
local ilovetheninties = game.Workspace:FindFirstChild(thebagel)

if ilovetheninties ~= nil then --you could just put if ilovetheninties then
ilovetheninties.Parent = nil
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 11:39 PM
still dont understand qq
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
12 Jul 2013 11:47 PM
x = game.Workspace.Baseplate

while true do
wait(0.1)
x.Transparency = 1
wait(5)
x.Transparency = 0
end

I hope this helped.
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 11:50 PM
That did help i kinda get it but why cant i just use this

x = Torso

while true do
game.Workspace.Player1.x.Transparency = 1
wait(1)
game.Workspace.Player1.x.Transparency = 0
end

Btw why do u need while true do?
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
12 Jul 2013 11:53 PM
You could do

x = game.Workspace.djboy.Torso


wait(0.1)
x.Transparency = 1

But I like doing while true do because it will make the transparency loop.
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
12 Jul 2013 11:55 PM
When ever scripting remember to type it like it says in game. So it's not torso it's Torso
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
12 Jul 2013 11:55 PM
But on the true part, Where in the script is there True?
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
12 Jul 2013 11:56 PM
Don't worry about it. There will be a error if you do "while do" you have to type "while true do".
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
13 Jul 2013 12:14 AM
What if i wanted to do this
x = Transparency = 1
How would i do that?
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
13 Jul 2013 12:17 AM
No it gives a error.
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
13 Jul 2013 12:28 AM
Have any more questions before I go back to building?
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
13 Jul 2013 12:32 AM
yea instead of x=game.Workspace.Player.Torso how do i do Right arm or Left leg etc
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
13 Jul 2013 12:43 AM
Hmm... Let see if I can remember how to do that.'


You would then have to do 2.

g = game.Workspace.thombot2
x = p:FindFirstChild("Left Arm")


wait(0.1)
x.Transparency = 1
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
13 Jul 2013 12:44 AM
@Thom you forgot to describe p :P
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
13 Jul 2013 12:46 AM
canada can u tell me instead?
Report Abuse
thombot2 is not online. thombot2
Joined: 15 Oct 2008
Total Posts: 104
13 Jul 2013 12:46 AM
XD Sorry change p to a g.... I typed it wrong.
Report Abuse
djboy is not online. djboy
Joined: 16 Mar 2008
Total Posts: 794
13 Jul 2013 12:49 AM
Wpuldent it have to be wait(0.1)
g.x.Transparency = 1
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