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
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
| |
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
| |
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
| |