| |
|
|
| 30 Dec 2015 01:42 PM |
local var = 'hi' print(var)
i just accessed it |
|
|
| Report Abuse |
|
|
Notwal
|
  |
| Joined: 31 Dec 2014 |
| Total Posts: 915 |
|
| |
|
|
| 30 Dec 2015 01:45 PM |
Didn't you use debounces?
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 02:06 PM |
for example
if true then x = 5 end
I want to access x again |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 02:06 PM |
local x
x = 5 print(x)
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2015 02:07 PM |
You can overwrite the variable too
The Legend of Heroes Sen no Kiseki |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 30 Dec 2015 05:55 PM |
| nevermind i think i got it |
|
|
| Report Abuse |
|
|