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: Any way to access a local variable?

Previous Thread :: Next Thread 
buildmodel is not online. buildmodel
Joined: 17 Jul 2012
Total Posts: 3778
30 Dec 2015 01:39 PM
.
Report Abuse
UnstableScript0 is not online. UnstableScript0
Joined: 21 Dec 2015
Total Posts: 1189
30 Dec 2015 01:42 PM
local var = 'hi'
print(var)

i just accessed it
Report Abuse
Notwal is not online. Notwal
Joined: 31 Dec 2014
Total Posts: 915
30 Dec 2015 01:44 PM
boom
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
30 Dec 2015 01:45 PM
Didn't you use debounces?


The Legend of Heroes Sen no Kiseki
Report Abuse
buildmodel is not online. buildmodel
Joined: 17 Jul 2012
Total Posts: 3778
30 Dec 2015 02:06 PM
for example

if true then
x = 5
end

I want to access x again
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
30 Dec 2015 02:06 PM
local x

x = 5
print(x)


The Legend of Heroes Sen no Kiseki
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
30 Dec 2015 02:07 PM
You can overwrite the variable too


The Legend of Heroes Sen no Kiseki
Report Abuse
buildmodel is not online. buildmodel
Joined: 17 Jul 2012
Total Posts: 3778
30 Dec 2015 02:14 PM
I cant access laserCopy at the very end

if active1 == true then
local laserCopy = Instance.new("Part", game.Workspace)
laserCopy.Name = "laser"
laserCopy.Material = "Plastic"
laserCopy.Transparency = 1
laserCopy.CanCollide = false
laserCopy.Size = Vector3.new(1, 1.22, 5.98)

local bv = Instance.new("BodyVelocity")
bv.Parent = laserCopy
bv.MaxForce = Vector3.new(7000, 7000, 7000)
bv.P = 5000
bv.Velocity = Vector3.new(-700, 0, 0)

local mesh = Instance.new("BlockMesh")
mesh.Parent = laserCopy
mesh.Offset = Vector3.new(0,0,0)
mesh.Scale = Vector3.new(0.1, 1, 1)

local leftDecal = Instance.new("Decal")
leftDecal.Parent = laserCopy
leftDecal.Texture = "http://www.roblox.com/asset/?id=336562365"
leftDecal.Face = "Left"

local rightDecal = Instance.new("Decal")
rightDecal.Parent = laserCopy
rightDecal.Texture = "http://www.roblox.com/asset/?id=336562365"
rightDecal.Face = "Right"
end


if active1 == true then
laserCopy.CFrame = main.CFrame
laserCopy.BodyVelocity.Velocity = main.CFrame.lookVector*200
laserCopy.BodyVelocity.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
delay(laserTime, function() laserCopy:Destroy() end)
end
Report Abuse
TheOsiris is not online. TheOsiris
Joined: 30 May 2010
Total Posts: 4534
30 Dec 2015 02:15 PM
local v = 1
local b = 2
local n = 3

print(v+b-n)
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
30 Dec 2015 02:17 PM
You should learn scoping.

if true then
local x = 5
print(x)
end

print(x)

------------

if true then
x = 5
print(x)
end

print(x)

------------

local x
if true then
x = 5
print(x)
end

print(x)
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
30 Dec 2015 02:29 PM
They both use the same variable == true why would you separate in the first place. And because the local is within the the first if then statement not the whole entire script :/


The Legend of Heroes Sen no Kiseki
Report Abuse
buildmodel is not online. buildmodel
Joined: 17 Jul 2012
Total Posts: 3778
30 Dec 2015 05:51 PM
I have it == true so I can turn the gun on/off soon

So.. how do I fix this :/
Report Abuse
buildmodel is not online. buildmodel
Joined: 17 Jul 2012
Total Posts: 3778
30 Dec 2015 05:55 PM
nevermind i think i got it
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