The script is used for a GUI. When a player clicks on the GUI button, if they do not have the tool in their backpack it will give them the tool. If they already have the tool, then it will remove the tool. Right now, the script will give me the tool, but if I click again it won't removing it.
However, if I put the tool in the StarterPack and run the script, it removes the tool. It just doesn't give it back again upon a second click. So the remove tool function works, however it doesn't seem to want to work together, or want to work after each other.
local plr = game.Players.LocalPlayer
local tools = plr.Backpack
Player=script.Parent.Parent.Parent.Parent
function ToolRemove()
if tools:findFirstChild("Tool") then
tools.Tool:Remove()
script.Parent.Selected=true
wait(.1)
end
end
function ToolAdd()
if game.Lighting:findFirstChild("Tool") then
Tool=game.Lighting.Tool:clone()
Tool.Parent=Player.Backpack
script.Parent.Selected=true
wait(.1)
end
end
script.Parent.MouseButton1Down:connect(function()
if script.Parent.Selected==false then
ToolRemove()
ToolAdd()
end
end)
Thank you very much!

3 comments
OHHHHHHHHHHHHHHHHHHHHHHHH thank you so much!!!!!!!!!!!!!!!!!!!!!!!!!!
I was helping her write the script, I was trying to make the else but I failed so i got rid of it and that was my code we ended up with, I can't believe we were that close, thanks for the fast reply too!
Haha no problem!