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
 

Weld Script Not Working (read)!

Previous Thread :: Next Thread 
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
25 Jan 2016 08:39 PM
Error: "Bullets isnt a valid member of tool." --the error im getting (not apart of script)

Example: http://www.roblox.com/games/347916821/Any-Help --of the weapons

Script model: http://www.roblox.com/Can-anyone-help-item?id=348167828 --the script + gun

Script:


--Weld script:

function Weld(x,y)
local W = Instance.new("Weld")
W.Part0 = x
W.Part1 = y
local CJ = CFrame.new(x.Position)
local C0 = x.CFrame:inverse()*CJ
local C1 = y.CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = x
end

function Get(A)
C = script.Parent.Handle:GetChildren()
if #C >= 7 then
stuff = script.Parent:getChildren()
for i = 1, #stuff do
if stuff[i].className == "Part" then
b = stuff[i]:GetChildren()
for i = 1, #b/2 do
if b.className == "Weld" then
b:remove()
end
end
end
end
end
if A.className == "Part" then
Weld(A, script.Parent.Handle)
A.Anchored = false
else
local C = A:GetChildren()
for i=1, #C do
Get(C[i])
end
end
end


function Finale()
Get(script.Parent)
end

--end weld

debounce=false

--Fire Weld + activate reload function for "r" key

function Equipped(mouse)
Finale()
local character = script.Parent.Parent.Name
local player = game.Players:findFirstChild(""..character.."")
if player ~= nil and (player.Backpack:findFirstChild("Glock 17") ~= nil) then
local new = game.Lighting.Weapons["Dual Glock 17"]:clone()
player.Backpack:findFirstChild("Glock 17"):remove()
new.Ammo.Value = new.Ammo.Value + script.Parent.Ammo.Value
new.Weld_Trig.Value = true
new.Parent = player.Backpack
script.Parent:remove()
end
if player ~= nil and (player.PlayerGui:findFirstChild("GameGui") ~= nil) then
player.PlayerGui.GameGui.Ammo.Visible = true
player.PlayerGui.GameGui.Ammo.Text = "Glock 17: "..script.Parent.Bullets.Value.."/12 "..script.Parent.Ammo.Value..""
end
script.Parent.Unequipped:connect(function()
Finale()
player.PlayerGui.GameGui.Ammo.Visible = false
end)
script.Parent.Ammo.Changed:connect(function()
player.PlayerGui.GameGui.Ammo.Text = "Glock 17: "..script.Parent.Bullets.Value.."/12 "..script.Parent.Ammo.Value..""
end)
script.Parent.Bullets.Changed:connect(function()
player.PlayerGui.GameGui.Ammo.Text = "Glock 17: "..script.Parent.Bullets.Value.."/12 "..script.Parent.Ammo.Value..""
end)
mouse.Icon = "http://www.roblox.com/asset/?id=68575043"
mouse.KeyDown:connect(function(key)
local InsertedValue = nil
if (key~=nil)and(key=="r")and(script.Parent.Bullets.Value<12)and(debounce==false)then
if (script.Parent.Ammo.Value > 0) then
debounce=true
if script.Parent.Ammo.Value + script.Parent.Bullets.Value > 12 then
script.Parent.Ammo.Value = script.Parent.Ammo.Value - (12 - script.Parent.Bullets.Value)
InsertedValue = 12
else
InsertedValue = script.Parent.Bullets.Value + script.Parent.Ammo.Value
script.Parent.Ammo.Value = 0
end
script.Parent.Bullets.Value = 0
script.Parent.Handle.Reload:play()
player.PlayerGui.GameGui.Ammo.Text = "RELOADING"
wait(1)
script.Parent.Bullets.Value = InsertedValue
debounce=false
end
end
end)
end

--end script above

--Auto reload function //////////////////////////////////////////////////

script.Parent.Bullets.Changed:connect(function()
local character = script.Parent.Parent.Name
local player = game.Players:findFirstChild(""..character.."")
local InsertedValue = nil
if (script.Parent.Bullets.Value<=0) and (debounce==false) then
if (script.Parent.Ammo.Value>0) then
debounce=true
if script.Parent.Ammo.Value + script.Parent.Bullets.Value > 12 then
script.Parent.Ammo.Value = script.Parent.Ammo.Value - (12 - script.Parent.Bullets.Value)
InsertedValue = 12
else
InsertedValue = script.Parent.Bullets.Value + script.Parent.Ammo.Value
script.Parent.Ammo.Value = 0
end
script.Parent.Bullets.Value = 0
script.Parent.Handle.Reload:play()
player.PlayerGui.GameGui.Ammo.Text = "RELOADING"
wait(1)
script.Parent.Bullets.Value = InsertedValue
debounce=false
end
end
end)

-- End Of Auto reload function //////////////////////////////////////////////////



--Equip, fire.
script.Parent.Equipped:connect(Equipped)
Finale()
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
25 Jan 2016 09:21 PM
bump
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
26 Jan 2016 10:13 PM
bump
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
27 Jan 2016 02:00 PM
bump
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