Hi I have a script that when I walk into a part and click "e" it gives me a gun. but for some reason after it loads into my backpack, the gun just doesn't work. It doesn't shoot, and the guis don't even show up. The gun works fine when you put it into starterpack, but for some reason when i click e, it doesn't work when it gets into my backpack.

local userInputService = game:GetService("UserInputService")



brick = game.Workspace.test --the part that gives the item
brick.Touched:connect(function(part) --When the part is touched,
    if part.Parent.Humanoid then
        if part.Parent.Humanoid.Health > 0 then --if the part is part of a live character model
			            Player = game.Players:GetPlayerFromCharacter(part.Parent) --gets the player
			userInputService.InputBegan:Connect(function(input,GPE)
	
				if input.KeyCode == Enum.KeyCode.E then
					wait(0.05)
						game.ReplicatedStorage.Guns["Assault Rifle"]:clone().Parent = Player.Backpack --clones the tool from replicated storage and puts it in the backpack.
					game.ReplicatedStorage.Guns["Assault Rifle"]:clone().Parent = game.ReplicatedStorage.Gunsholder
					game.ReplicatedStorage.Guns["Assault Rifle"]:Destroy()
					end
				end)

				end
			end					
 
end)

1 comment

0

This script may be interfering with the tool. Can you tell me what script your gun uses or if you are using some type of gun system like ACS?