Tools disappearing after I equip them for no reason

Hi Developers! :wave:

I recently stumbled upon a serious problem that ruins my game COMPLETELY. For some reason when I want to equip my weapon, the weapon just disappears from backpack! The most interesting thing is that I didn’t even edit anything when this bug appeared. :cry:

This is my second time encountering this error, first time it was occuring because of cloning weapons on the client, but now it doesn’t work for some other reason. Here is the weapon assigner script btw:

local rs = game.ReplicatedStorage

local re = game.ReplicatedStorage:WaitForChild("EquipWeaponRE")
local re2 = game.ReplicatedStorage:WaitForChild("DeployRE")

local primary
local secondary
local melee


--giving remote events
local GiveFolder = game.ReplicatedStorage.WeaponGivingHandlers

local giveprimary = GiveFolder.GivePrimary
local givesecondary = GiveFolder.GiveSecondary
local givemelee = GiveFolder.GiveMelee

re.OnServerEvent:Connect(function(plr, gun)
	warn("assinged weapon", gun)
	local weapons = plr.Weapons
	warn(weapons, plr)

	if gun and gun.Parent.Parent.Parent == weapons then

		local gunType = gun.Parent.Name
		warn(gunType)
		
		if gunType == "Primary" then
			giveprimary:FireClient(plr, gun)
			primary = gun
			warn("primary", primary)
		end
		if gunType == "Secondary" then
			givesecondary:FireClient(plr, gun)
			secondary = gun
			warn("secondary", secondary)
		end
		if gunType == "Melee" then
			givemelee:FireClient(plr, gun)
			melee = gun
			warn("melee", melee)
		end
	end
	print(primary, secondary, melee)
end)

rs.WeaponGivingHandlers.ToServer.ToServerPrimary.OnServerEvent:Connect(function(plr, gun)
	gun:Clone().Parent = plr.Backpack
	print("PRIMARY")
end)
rs.WeaponGivingHandlers.ToServer.ToServerSecondary.OnServerEvent:Connect(function(plr, gun)
	gun:Clone().Parent = plr.Backpack
	print("SECONDARY")
end)
rs.WeaponGivingHandlers.ToServer.ToServerMelee.OnServerEvent:Connect(function(plr, gun)
	gun:Clone().Parent = plr.Backpack
	print("MELEE")
end)
I tried multiple ways to fix that :
  1. Making the weapon anchored and enabling collisions, I didn’t even see the actual weapon

  2. Checking if there are some scripts that are breaking the script above, didn’t find anything

  3. Moved weapons to the other game, and it worked somehow!

  4. Tried to manually weld tool to the characters arm, didn’t work

Here’s a gameplay example how it doesn’t work: https://youtu.be/w65C-H2CQ2k

If you need some more detailed screenshots or code examples, please, tell me! I would appreciate any help provided!

So… I tried to replace the whole system again without any client scripts system, and it worked perfectly fine… I’ll try to find that pesky problem when I will have some leisure time

Seems to be more of a frontend issue than a backend one. Send us your LocalScript. On another note, if your game isn’t single-player, then the script you’ve given us so far will have major issues supporting that

1 Like

I think that’s the script you’re looking for (I’m sending the whole code to make sure I didn’t miss something important):

task.wait()
local TweenService = game:GetService("TweenService")
local rs = game.ReplicatedStorage
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local mouse = player:GetMouse()

local currentCamera = workspace.CurrentCamera

local gui = script.Parent

local loadingframe = gui.Loading
local title = gui.Title
local play = gui.Play
local setting = gui.Settings
local credits = gui.Credits
local shop = gui.Shop
local loadout = gui.Loadout


local back2  = gui.Back2
local back3 = gui.Back3
local back4 = gui.Back4
local back5 = gui.Back5
local Black = gui.Black


--actual frames
local FLoadout = script.Parent.Frames.LoadoutFrame
local FSettings = script.Parent.Frames.SettingsFrame
local FCredits = script.Parent.Frames.CreditsFrame

local folder = workspace.MenuWorldAssets

local inMenu = true

local WhichCamera = 1


--[[ Humanoid thing cool
folder.Rig:WaitForChild("HumanoidRootPart")

character.HumanoidRootPart.CFrame = folder.Rig.HumanoidRootPart.CFrame


local loadR15 = character.Humanoid:LoadAnimation(folder.Settings.R15Idle)
loadR15.Priority = Enum.AnimationPriority.Action4
loadR15:Play()

local loadR6 = character.Humanoid:LoadAnimation(folder.Settings.R6Idle)
loadR6.Priority = Enum.AnimationPriority.Action4
loadR6:Play()]]


folder:WaitForChild("CameraPart")


local function SetMenuCamera()
	repeat wait()
		currentCamera.CameraType = Enum.CameraType.Scriptable
		currentCamera.CFrame = folder.CameraPart.CFrame
		warn("intialized camera", currentCamera)
	until currentCamera.CFrame == folder.CameraPart.CFrame
end
SetMenuCamera()







local function UpdateUI(value)
	for i, obj in pairs(gui:GetChildren()) do
		if obj:IsA("SurfaceGui") then
			if obj == script.Parent.Voting then
				continue
			else
				obj.Enabled = value
			end


		elseif obj:IsA("Folder") then
			for i, obj2 in pairs(obj:GetChildren()) do
				if obj2:IsA("SurfaceGui") then
					obj2.Enabled = value

				end
			end		
		end
	end
end





local maxTilt = 10
game:GetService("RunService").RenderStepped:Connect(function()
	if inMenu == true then
		
		-- PC users support
		if game:GetService("UserInputService").MouseEnabled and game:GetService("UserInputService").KeyboardEnabled then
			
			
			
			if WhichCamera ==1 then
				workspace.CurrentCamera.CFrame = folder.CameraPart.CFrame * CFrame.Angles(
					math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
					math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
					0
				)

			elseif WhichCamera == 2 then
				workspace.CurrentCamera.CFrame = folder.CameraPart2.CFrame * CFrame.Angles(
					math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
					math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
					0
				)



			elseif WhichCamera == 3 then
				workspace.CurrentCamera.CFrame = folder.CameraPart3.CFrame * CFrame.Angles(
					math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
					math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
					0
				)

			elseif WhichCamera == 4 then
				workspace.CurrentCamera.CFrame = folder.CameraPart4.CFrame * CFrame.Angles(
					math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
					math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
					0
				)

			elseif WhichCamera == 5 then
				workspace.CurrentCamera.CFrame = folder.CameraPart5.CFrame * CFrame.Angles(
					math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
					math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
					0
				)
			end
			
			--mobile users support
		elseif game:GetService("UserInputService").TouchEnabled then end
		
	end
end)



-- the play button thingy that is really crucial
play.Frame.Button.Activated:Connect(function()
	
	
	--[[if workspace:FindFirstChildOfClass("SpawnLocation") then
		character.HumanoidRootPart.CFrame = workspace:FindFirstChildOfClass("SpawnLocation").CFrame * CFrame.new(0, 2, 0)
	else
		character.HumanoidRootPart.CFrame = CFrame.new(0, 2, 0)
	end]]
	
	if rs.Booleans.Intermission.Value == false then
		script.Parent.Loading.Visible = true
		TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 40}):Play()
		TweenService:Create(loadingframe, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()
	--[[TweenService:Create(loadingframe, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()
	TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 40}):Play()]]

		for i = 1, 12 do
			local cmd = script.TextLabel:Clone()
			cmd.Parent = loadingframe.Frame
			cmd.Name = "cmd"

			if i == 1 then
				cmd.Text = "> loading system..."
				task.wait(.1)
				cmd.Text = "> loading system.."
				task.wait(.1)
				cmd.Text = "> loading system."
				task.wait(.1)
				cmd.Text = "> loading system"
				task.wait(.1)
				cmd.Text = "> loading system."
				task.wait(.1)
				cmd.Text = "> loading system.."
				task.wait(.1)
				cmd.Text = "> loading system..."
				task.wait(.1)
				cmd.Text = "> loading system/execute/Succces%20Initialized"

			elseif i == 2 then
				cmd.Text = "> " ..player.Name.." joining the battle"

			elseif i == 3 then
				cmd.Text = "> getting player data... 0/"..#player:GetChildren()

				for v = 1, #player:GetChildren() do
					cmd.Text = "> getting player data... "..v.."/"..#player:GetChildren()
					task.wait(.01)
				end

			elseif i == 4 then
				cmd.Text = "> loading assets... 0/"..#workspace:GetChildren()

				for v = 1, #workspace:GetChildren() do
					cmd.Text = "> loading assets... "..v.."/"..#workspace:GetChildren()
					task.wait(.01)
				end

			elseif i == 5 then
				cmd.Text = "> importing files 0/"..#game.ReplicatedStorage:GetChildren()

				for v = 1, #game.ReplicatedStorage:GetChildren() do
					cmd.Text = "> importing files... "..v.."/"..#game.ReplicatedStorage:GetChildren()
					task.wait(.01)
				end

			elseif i == 6 then
				cmd.Text = "> running system.exe."
				task.wait(.1)
				cmd.Text = "> running system.exe.."
				task.wait(.1)
				cmd.Text = "> running system.exe..."

			elseif i == 7 then
				cmd.Text = "> booting up the game."
				task.wait(.05)
				cmd.Text = "> booting up the game.."
				task.wait(.05)
				cmd.Text = "> booting up the game..."

			elseif i == 8 then
				cmd.Text = ""

			elseif i == 9 then
				cmd.Text = "> Retrox:\some_bad_guy>Join Success!"

			elseif i == 10 then
				cmd.Text = "> 01010011 01101111 00101100 00100000 01110101 01110011 01101001 01101110 01100111\n 00100000 01110100 01110010 01100001 01101110 01110011 01101100 01100001 01110100 01101111 01110010 00100000 01100001 01101100 01110010 01100101 01100001 01100100 01111001 00111111 00100000 01010111 01100101 01101100 01101100 00101100 00100000 01111001 01101111 01110101 00100111 01110010 01100101 00100000 01100111 01101111 01101110 01101110 01100001 00100000 01100100 01101111 00100000 01101001 01110100 00100000 01100001 00100000 01101100 01101111 01110100"

			elseif i == 11 then
				cmd.Text = "> 01010010 01101111 01100010 01101100 01101111 01111000 01000011 01100001 01110100 11100010 10000001 10111011 11000010 10111001 00100000 01101001 01110011 00100000 01110010 01100101 01100001 01101100"

			elseif i == 12 then
				cmd.Text = "> entering the battle"
			end

			task.wait(.1)
		end
		
		loadingframe.Frame.Visible = false
		
		for i, obj in pairs(loadingframe.Frame:GetChildren()) do
			if obj.Name == "cmd" then
				obj:Destroy()
			end
		end

		task.wait(1)

		currentCamera.FieldOfView = 30
		TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 70}):Play()
		TweenService:Create(loadingframe, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()


		inMenu = false
		currentCamera.CameraType = Enum.CameraType.Custom
		
		--firing the event to make player appear in battle
		rs.RemoteEvents.PlayPressed:FireServer(player)
		script.Parent.Parent.CustomHotBarGui.Enabled = true

		task.wait(1)

		TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 70}):Play()
		TweenService:Create(loadingframe, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
		
		
		
		
		



		------------disabling these GUI's------------------------------------
		UpdateUI(false)
	else
		print('No ongoing match!')
	end

end)



--=====================Hold On Death===========================

player.CharacterAdded:Connect(function()

	folder:WaitForChild("CameraPart")
	inMenu = true
	
	loadingframe.Frame.Visible = true

	SetMenuCamera()
	
	UpdateUI(true)
	
end)


--=============================================================
--===================Round End Handle==========================
--=============================================================
rs.RoundEnded.OnClientEvent:Connect(function()
	
	TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 70}):Play()
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()
	
	task.wait(0.5)
	
	local char = workspace:WaitForChild(player.Name).Humanoid
	print(char, player)
	char:UnequipTools()
	script.Parent.Parent.CustomHotBarGui.Enabled = false


	inMenu = true
	UpdateUI(true)
	SetMenuCamera()
	if player.Backpack:GetChildren() then
		for i, e in pairs(player.Backpack:GetChildren()) do
			e:Destroy()
		end
	end
	
	task.wait(0.5)

	TweenService:Create(currentCamera, TweenInfo.new(.8, Enum.EasingStyle.Back), {FieldOfView = 70}):Play()
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
	
	print(player.Backpack:GetChildren())
end)


--=============================================================
--=====================Weapon assign===========================
--=============================================================


--weapon containers
local primary-- = script.Parent.Parent.Primary.Value
local secondary-- = script.Parent.Parent.Secondary.Value
local melee-- = script.Parent.Parent.Melee.Value




--Getting variables' value

rs.WeaponGivingHandlers.GivePrimary.OnClientEvent:Connect(function(gun)
	primary = gun
	--warn("saved data into 'primary' and player as:", gun, player)
end)

rs.WeaponGivingHandlers.GiveSecondary.OnClientEvent:Connect(function(gun)
	secondary = gun
	--warn("saved data into 'secondary' and player as:", gun, player)
end)

rs.WeaponGivingHandlers.GiveMelee.OnClientEvent:Connect(function(gun)
	melee = gun
	--warn("saved data into 'melee' and player as:", gun, player)
end)





local Actionfolder = rs.WeaponGivingHandlers.ToServer

local toserverprimary = Actionfolder.ToServerPrimary
local toserversecondary = Actionfolder.ToServerSecondary
local toservermelee = Actionfolder.ToServerMelee



script.Parent.Play.Frame.Button.MouseButton1Click:Connect(function()
	if rs.Booleans.Intermission.Value == false then
		
		--warn("clicked")
		warn('weapons', primary, secondary, melee)
		if primary then
			--warn("equipping primary", primary)
			--local gunClone = primary:Clone()
			toserverprimary:FireServer(primary)
			--gunClone.Parent = player.Backpack
		end

		if secondary then
			--warn("equipping secondary", secondary)
			--local gunClone = secondary:Clone()
			toserversecondary:FireServer(secondary)
			--gunClone.Parent = player.Backpack
		end

		if melee then
			--warn("equipping melee", melee)
			--local gunClone = melee:Clone()
			toservermelee:FireServer(melee)
			--gunClone.Parent = player.Backpack

		end
	else
		print('did not run')
	end
end)








--================================================================================================================================================================================
--buttons and back button functions===============================================================================================================================================
--================================================================================================================================================================================


--all the backs================================
back2.Frame.Button.Activated:Connect(function()
	
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()
	
	task.wait(1)
	
	WhichCamera = 1
	currentCamera.CFrame = folder.CameraPart.CFrame
	

	
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


back3.Frame.Button.Activated:Connect(function()
	
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()
	
	task.wait(1)

	WhichCamera = 1
	currentCamera.CFrame = folder.CameraPart.CFrame
	

	
	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


back4.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 1
	currentCamera.CFrame = folder.CameraPart.CFrame



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


back5.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 1
	currentCamera.CFrame = folder.CameraPart.CFrame



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------





shop.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 4
	currentCamera.CFrame = folder.CameraPart4.CFrame



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


loadout.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 5
	currentCamera.CFrame = folder.CameraPart5.CFrame



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)






setting.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 2
	currentCamera.CFrame = folder.CameraPart2.CFrame
	--warn("pressed", setting, currentCamera)



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)


credits.Frame.Button.Activated:Connect(function()

	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(1,0, 1,0)}):Play()

	task.wait(1)

	WhichCamera = 3
	currentCamera.CFrame = folder.CameraPart3.CFrame
	--warn("pressed", credits, currentCamera)



	TweenService:Create(Black, TweenInfo.new(.3), {Size = UDim2.new(0,0, 0,0)}):Play()
end)







--================================================================================================================================================================================
--Mouse enter things===========--=================================================================================================================================================
--================================================================================================================================================================================


setting.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(setting.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

setting.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(setting.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


play.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(play.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

play.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(play.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


credits.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(credits.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

credits.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(credits.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


back2.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(back2.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

back2.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(back2.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


back3.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(back3.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

back3.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(back3.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


back4.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(back4.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

back4.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(back4.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


back5.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(back5.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

back5.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(back5.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


loadout.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(loadout.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

loadout.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(loadout.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)


shop.Frame.Button.MouseEnter:Connect(function()
	TweenService:Create(shop.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0.95,0,0.95,0)}):Play()
end)

shop.Frame.Button.MouseLeave:Connect(function()
	TweenService:Create(shop.White, TweenInfo.new(.8, Enum.EasingStyle.Exponential), {Size = UDim2.new(0,0,0.95,0)}):Play()
end)
--==========================





--================================================================================================================================================================================
--=========================Shop functionality=====================================================================================================================================
--================================================================================================================================================================================


local MarketplaceService = game:GetService("MarketplaceService")
local layout = script.PassFrame
local PassesFrame = script.Parent.Frames.ShopFrame.Frame.ButtonsSector.ScrollingFrame


local ids = {
	169225577,
	1002950368,
	1004204303
}


for i, id in pairs(ids) do
	
	local success, productInfo = pcall(function()
		return MarketplaceService:GetProductInfo(id, Enum.InfoType.GamePass)
	end)


	if success and productInfo then
		if productInfo.IsForSale then
			
			local button = layout:Clone()
			button.Name = productInfo.Name
			button.Parent = PassesFrame
			
			button.F.PassNameLabel.Text = productInfo.Name
			button.F.Button.Text = productInfo.PriceInRobux
			button.F.Img.Image = "rbxassetid://" .. productInfo.IconImageAssetId
			
			
			--print("Description: " .. productInfo.Description)
			
			--warn("Created gamepass with such things:", id, productInfo.IconImageAssetId, productInfo.PriceInRobux, productInfo.Name, button.Parent)
			
			
			button.F.Button.MouseButton1Click:Connect(function()
				MarketplaceService:PromptPurchase(player, id)
				MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, doubleIDcheck, purchaseSuccess)
					if purchaseSuccess and doubleIDcheck == id then
						print(player.Name .. " purchased the Pass with ID " .. id)
						game.ReplicatedStorage.DiedRE:FireServer()
						
					else
						print("bad guy", player, "didn't buy anything >:(")
					end
				end)
			end)
			
		else
			print("This product isn't for sale", id)
		end
	end
end

My question would be, is there any code that you have that like attaches the weapon to the player or smth like that?

My guess is that the weapons are probably falling out of the world when you attempt to equip them, which would well, delete them.

Unless theres something that destroys the weapons, that’d be my guess.

1 Like

I’m using thienbao’s FE Gun Kit, maybe there is a script that does it.

But when enabling collisions/anchored it doesn’t drop a weapon or teleport the character to it…

It’s probably something with the LocalScript as @Ziffixture posted previously, I’ll check that later tomorrow

1 Like

Umm, so I found the problem… It is a bit awkward, but there was a humanoid with EXACT same name as mine, and it was causing this mess. Thank you all for helping me, I really appreciate that you took some time with me.

1 Like