Hi, i made a localscript that removes your tools if you click the gui, however, if you click the gui while equipping a tool, the tool will still remain and it will get located into game.Workspace.(Player's model). I wan't to remove that tool too but i don't have any idea on how to do that. Please help me! Here are the codes i used for my script.

state = true
f = script.Parent.Parent.EpixShop
f.Visible = false

function click()
	if state == true then
		script.Parent.ImageTransparency = 0.5
		f.Visible  = true
		state = false
		for _,child in pairs(script.Parent.Parent.Parent.Parent.Backpack:GetChildren()) do
			if child.ClassName == "Tool" or child.ClassName == "HopperBin" then
				print ("Removed "..child.Name.."!")
				child:remove()
			else
				script.Parent.ImageTransparency = 0
				f.Visible = false
				state = true
			end
		end
	end
end

script.Parent.MouseButton1Down:connect(click)

3 comments

0

Do the same thing for the players Character. Also, use LocalPlayer, so you don't have to use Parents.

0

use child:Destroy() it is a much simpler and easier option.

0

I still can't get into the player, i end up with this. for _,child bla bla and then (game.Workspace.how do i get the player model in workspace:GetChildren()) do and then bla bla you know