I have been adding to a script that is supposed to take care of when E is pressed and the mouse is hovered over a certain model/part it will add that weapon to the custom backpack I made. I have been adding the ammo part but one of my ends keep giving this one error:
Expected ")" (to close "(" at line 16), got "end"
I don't know what it means. I suggested that it wanted me to add a bracket to close the anonymous function which is what is on line 16 but there is already an end) for both of the functions. But anyway here is the script that the error is coming from:
local RunService = game:GetService("RunService") local Player = game:GetService("Players").LocalPlayer local uis = game:GetService("UserInputService") local Mouse = Player:GetMouse() local character = Player.Character local ActiveParts = workspace:WaitForChild("Weapons") local nextslot = character:WaitForChild("weapons").nextslot local Tag = script.Parent RunService.RenderStepped:connect(function() Tag.Position = UDim2.new(0,Mouse.X-Tag.AbsoluteSize.X,0,Mouse.Y-Tag.AbsoluteSize.Y) local Target = Mouse.Target if Target and ActiveParts:IsAncestorOf(Target) then Tag.Visible = true else Tag.Visible = false uis.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.E then local children = workspace.Weapons:GetChildren() for i, child in ipairs(children) do if Target.Parent.Name == "weapon" then Target.Parent.Rarity.Fire.Enabled = false Target.Parent.Parent = character.weapons.backpack:WaitForChild("slot"..nextslot.Value) script.Parent.Parent.Parent.Items:WaitForChild("slot"..nextslot.Value).hasitem.Value = true print(nextslot) elseif Target.Parent.Name == "ammo" then print("Ammo") if Target.Parent.Type == "Light" then print("Light") character.weapons.ammo.light.Value = character.weapons.ammo.light.Value + Target.Parent.Amount.Value Target.Parent:Destroy() elseif Target.Parent.Type == "Shells" then print("Shells") character.weapons.ammo.shells.Value = character.weapons.ammo.shells.Value + Target.Parent.Amount.Value Target.Parent:Destroy() elseif Target.Parent.Type == "Rockets" then print("Rockets") character.weapons.ammo.rockets.Value = character.weapons.ammo.rockets.Value + Target.Parent.Amount.Value Target.Parent:Destroy() elseif Target.Parent.Type == "Medium" then print("Medium") character.weapons.ammo.medium.Value = character.weapons.ammo.medium.Value + Target.Parent.Amount.Value Target.Parent:Destroy() elseif Target.Parent.Type == "Heavy" then print("Heavy") character.weapons.ammo.Heavy.Value = character.weapons.ammo.Heavy.Value + Target.Parent.Amount.Value Target.Parent:Destroy() end end end end end end end end end) end end)
The red underline end is on line 52. Help would be appreciated.