local tool = script.Parent local equipado = false local maxammo = 50 local MouseD = false tool.Equipped:connect(function(equipar) equipado = true char = tool.Parent player = game.Players:GetPlayerFromCharacter(char) equipar.Icon = "http://www.roblox.com/asset/?id=79658449" gui = tool.GUI:Clone() gui.Parent = player.PlayerGui end) function reload() if tool.ammo.Value ~= 50 and tool.ammo.Value <50 then wait(2) tool.ReloadSound:play() tool.ammo.Value = 50 end end equipar.KeyDown:connect(function(key) key = key:lower() if key == "r" then reload() end end) -- Disparando equipar.Button1Up:connect(function() MouseD = false end) equipar.Button1Down:connect(function() MouseD = true if script.Parent.ammo >0 then tool.FireSound:play() tool.ammo.Value = tool.ammo.Value - 1 tool.Flash.PointLight.Brightness = 5 tool.Flash.Transparency = 0 bala = Instance.new("Part") bala.Parent = Workspace bala.BrickColor = BrickColor.new("Cool yellow") bala.Size = Vector3.new(1,1,1) bala.Name = B remover = script.Parent.remover:Clone() remover.Parent = bala balaM = Instance.new("SpecialMesh") balaM.MeshType = "Sphere" balaM.Parent = bala balaM.Scale = Vector3.new(0.2,0.2,0.2) wait(0.05) tool.Flash.PointLight.Brightness = 0 tool.Flash.Transparency = 1 end end)
Spanish scripter huh? Glad to see i'm not the only spanish scripter here.
--[[Line 59]] bala.Name = B
The script doesn't seem to show any value called "B" If these weren't your intentions, Use
bala.Name="B"
In the rest, I don't see anything wrong, except for the line 19, We don't know if it has a loop or anything in the Cloned Gui, but your script can be optimized.
But could really that line make your game crash? Are you sure you have any "While true do" loops in your game or tool?
Weld scripts have a small chance of crashing your game too.
Honestly having a while "true" do in the while loop is completely pointless, waste of code, many people do that.
A better way is using:
while wait() do print("Sup") end --[[If you're using the loop to update certain properties or values of an object, for performance reasons, it's suggested to use]] while wait(1.5) do --Could be longer or shorter, you decide. --ValueUpdate end