The item is broken when i equip it


HeyDevs i got a proplem when i press on equip and item appear on the backpack the items stops from working even when i click too much to get it work and thats a photos for a btools example

and this is the script i used for equip button:

local toolName = "ItemName"                                        
local replicatedStorage = game.ReplicatedStorage
local tool = replicatedStorage.Items:FindFirstChild(toolName)

script.Parent.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
	local backpack = player:FindFirstChild("Backpack")

	if not backpack then
		warn("no beckpeck")
		return
	end

	if script.Parent.Text == "Equip" then
		if tool then
			local equippedTool = tool:Clone()
			equippedTool.Parent = backpack
			script.Parent.Text = "Unequip"
		else
			warn("tool isnt in rep storage")
		end
	elseif script.Parent.Text == "Unequip" then
		local existingTool = backpack:FindFirstChild(toolName)
		if existingTool then
			existingTool:Destroy()
			script.Parent.Text = "Equip"
		end
	end
end)

And thx

Screenshot_2024_0908_222204
where’s the last double quotation

2 Likes

Are you coding in a text editor or in studio?

like pankii said, where is your double quotation?
annihilate that you should get used to using output.
View → Output. it dumps errors, warnings, prints very useful.
also if the tool has a server script I don’t know if it will replicate if your doing this on a client script, so you may want to create a remote event telling the server what item to give to who and fire it from the client.
But hey that’s a assumption, playtest and see what works.

its on the script i just delete it with missclick while copying the script to post this

The problem is pretty much in the scripts inside the tools as there is no errors/bugs in your script, I would suggest modifying the scripts inside to make them start/work when you equip the tool.

1 Like

maybe its a good idea + my scripter friend said that the tools are not working cuz i dont have the permmision to them and i need to republish it to work idk if he was right abt what he saying …

1 Like

well its all scripted in the studio

To fully make sure, Test with your own tools first

well thx mate i will make sure to test it and if it not working with toolbox tools i might create my own tools do the same job : D

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.