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: It wont listen to my script.

Previous Thread :: Next Thread 
Gofven is not online. Gofven
Joined: 18 Jun 2015
Total Posts: 767
19 Sep 2016 01:48 AM
Well for some strange reason my script doesn't work if _G.Tc1TrainDoorsShut = false, I wonder why? The thing that happens is all parts and objects just gets non-existent.

local D = game.Workspace.Train.Triggers.Doors
_G.Tc1TrainDoorsShut = true
local D1 = D.D1
local D2 = D.D2
local D3 = D.D3
local D4 = D.D4
local D5 = D.D5
local D6 = D.D6
local D7 = D.D7
local D8 = D.D8
x = 0
y = true

while wait() do
wait(1)
D1.Part.Transparency = x
D1.Part.CanCollide = y
D1.Union.Transparency = x
D1.Union.CanCollide = y
D2.Part.Transparency = x
D2.Part.CanCollide = y
D2.Union.Transparency = x
D2.Union.CanCollide = y
D3.Part.Transparency = x
D3.Part.CanCollide = y
D3.Union.Transparency = x
D3.Union.CanCollide = y
D4.Part.Transparency = x
D4.Part.CanCollide = y
D4.Union.Transparency = x
D4.Union.CanCollide = y
D5.Part.Transparency = x
D5.Part.CanCollide = y
D5.Union.Transparency = x
D5.Union.CanCollide = y
D6.Part.Transparency = x
D6.Part.CanCollide = y
D6.Union.Transparency = x
D6.Union.CanCollide = y
D7.Part.Transparency = x
D7.Part.CanCollide = y
D7.Union.Transparency = x
D7.Union.CanCollide = y
D8.Part.Transparency = x
D8.Part.CanCollide = y
D8.Union.Transparency = x
D8.Union.CanCollide = y
if _G.Tc1TrainDoorsShut == true then
x = 0
y = true
else
x = 1
y = false
end
end
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
19 Sep 2016 02:06 AM
holy crap look up Generic_For in the wiki
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
19 Sep 2016 02:10 AM
for _,part in next,doors:getChildren() do
v.Transparency,v.CanCollide = (var and 0) or 1,var
end
Report Abuse
Wunder_Wulfe is not online. Wunder_Wulfe
Joined: 13 Sep 2016
Total Posts: 8356
19 Sep 2016 02:11 AM
literally just shortened 60% of your code into 3 lines
Report Abuse
jaredc1234 is not online. jaredc1234
Joined: 03 Jun 2011
Total Posts: 588
19 Sep 2016 03:44 AM
If you're copying and pasting a lot of stuff, you're doing it wrong.
Report Abuse
Gofven is not online. Gofven
Joined: 18 Jun 2015
Total Posts: 767
19 Sep 2016 10:12 AM
local D = game.Workspace.Train.Triggers.Doors.D1
_G.Tc1TrainDoorsShut = true

while wait() do
if _G.Tc1TrainDoorsShut == true then

for _, v in pairs(D) do
if v:IsA("BasePart") then
v.Transparency = 1
v.CanCollide = false

end
end
end
end

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

Error logs:

17:11:23.382 - ServerScriptService.TrainDoors:7: bad argument #1 to 'pairs' (table expected, got Object)
Report Abuse
Gofven is not online. Gofven
Joined: 18 Jun 2015
Total Posts: 767
19 Sep 2016 10:14 AM
I forgot getchildren()
Report Abuse
Gofven is not online. Gofven
Joined: 18 Jun 2015
Total Posts: 767
19 Sep 2016 10:23 AM
Update: I fixed the issue but something makes all part in the folder(not unions) dissapear? Please tell me WHY it happens (It just dissapeared, i saw it in the editor?)
Report Abuse
jaredc1234 is not online. jaredc1234
Joined: 03 Jun 2011
Total Posts: 588
19 Sep 2016 12:12 PM
"if v:IsA("BasePart") then
v.Transparency = 1
v.CanCollide = false"


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