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: Help!

Previous Thread :: Next Thread 
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
17 Jul 2013 09:12 PM
I don't always use GetChildren() but when I do I suck at it...

Basically I need help inserting anything in the value loadout basically which are the guns it wont insert them.



function play()
local w = script.Parent.Parent.Parent.Parent.WHITEOUT
w.BackgroundTransparency = 1
for i = 1,10 do
w.BackgroundTransparency = w.BackgroundTransparency - .1
wait(.2)
end
script.Parent.Parent.Parent.Visible = false
spawnplayer()
for i = 1,10 do
w.BackgroundTransparency = w.BackgroundTransparency + .1
wait(.2)
end

-- I checked and then double checked all this. All the places are in the correct place. I think it is the for o,weps thingy. HELP

local loadout = script.Parent.Parent.Parent.Parent.Parent.Parent.loadout
for o, weps in next, weaps do --weps is your table
print(weaps)
weaps.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack




end
end
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
17 Jul 2013 09:16 PM
Where is the variable 'weaps' defined? If that's the whole code, then it isn't defined anywhere and it isn't surprising your code doesn't work.
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
17 Jul 2013 09:20 PM
Heres the whole script:


function spawnplayer()
if game.Players.Playing.Value == true then
local p = script.Parent.Parent.Parent.Parent.Parent.Parent
if p.TeamColor == BrickColor.new("Bright blue") then
p.Character.Torso.CFrame = CFrame.new(game.Workspace.bs1.CFrame.p or game.Workspace.bs2.CFrame.p)
elseif p.TeamColor == BrickColor.new("Bright red") then
p.Character.Torso.CFrame = CFrame.new(game.Workspace.rs1.CFrame.p or game.Workspace.rs2.CFrame.p)
end
end
end


function play()
local w = script.Parent.Parent.Parent.Parent.WHITEOUT
w.BackgroundTransparency = 1
for i = 1,10 do
w.BackgroundTransparency = w.BackgroundTransparency - .1
wait(.2)
end
script.Parent.Parent.Parent.Visible = false
spawnplayer()
for i = 1,10 do
w.BackgroundTransparency = w.BackgroundTransparency + .1
wait(.2)
end
local loadout = script.Parent.Parent.Parent.Parent.Parent.Parent.loadout
for o, weps in next, weaps do --weps is your table
print(weaps)
weaps.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack
end
end


local a = script.Parent.Box

script.Parent.MouseEnter:connect(function()
a.Visible = true
end)

script.Parent.MouseLeave:connect(function()
a.Visible = false
end)

script.Parent.MouseButton1Down:connect(function()
if game.Players.Playing.Value == true then
play()
end
end)
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
17 Jul 2013 09:23 PM
Where are the guns you want to insert located? Right now, your code basically tries to get them out of nowhere, which doesn't make sense.
Report Abuse
StudioAD is not online. StudioAD
Joined: 14 Jul 2013
Total Posts: 9
17 Jul 2013 09:25 PM
There in lighting
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
17 Jul 2013 09:27 PM
I double and then triple checked where the script is getting the guns. If you want a breakdown heres how it goes:

script> play> buttons> MainFrame> Menu> PlayerGui> Player> loadout> guns

It is a NumberValue in the player inserted every time PlayerAdded and I am sure. I think I need help with the for and do statement
Report Abuse
StudioAD is not online. StudioAD
Joined: 14 Jul 2013
Total Posts: 9
17 Jul 2013 09:34 PM
bump <3
Report Abuse
ToboboT is not online. ToboboT
Joined: 25 Jun 2011
Total Posts: 2385
17 Jul 2013 09:39 PM
Bumpity boompbump
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
17 Jul 2013 09:43 PM
I've cleaned up the code a bit, and I might or might not have fixed the issue, depending on where the guns are actually located. You say `loadout` is a NumberValue, but if it's a NumberValue, where are the guns?

local Players = Game:GetService('Players')
local player = script.Parent.Parent.Parent.Parent.Parent.Parent

function spawnplayer()
  if game.Players.Playing.Value then
    if player.TeamColor == BrickColor.new('Bright blue') then
      player.Character.Torso.CFrame = CFrame.new(Workspace.bs1.CFrame.p or Workspace.bs2.CFrame.p)
    elseif player.TeamColor == BrickColor.new('Bright red') then
      player.Character.Torso.CFrame = CFrame.new(Workspace.rs1.CFrame.p or Workspace.rs2.CFrame.p)
    end
  end
end


function play()
  local w = script.Parent.Parent.Parent.Parent.WHITEOUT
  for background_transparency = 1, 0, -.1 do
    w.BackgroundTransparency = background_transparency
    wait(.2)
  end
  script.Parent.Parent.Parent.Visible = false
  spawnplayer()
  for background_transparency = 0, 1, .1 do
    w.BackgroundTransparency = background_transparency
    wait(.2)
  end
  local loadout = script.Parent.Parent.Parent.Parent.Parent.Parent.loadout
  local weapons = loadout -- Are the guns located there?
  for _, weapon in next, weapons:GetChildren() do
    weapon.Parent = script.Parent.Parent.Parent.Parent.Parent.Parent.Backpack
  end
end


local box = script.Parent.Box

script.Parent.MouseEnter:connect(function()
  box.Visible = true
end)

script.Parent.MouseLeave:connect(function()
  box.Visible = false
end)

script.Parent.MouseButton1Down:connect(function()
  if Players.Playing.Value then
    play()
  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