Hey guys, and thank you very much for helping me out a little while ago (Whomever you were). Now, while I was building, I caught a problem that I could not figure out how to solve. How would you clone a tool named "Sword" in Lighting into a player's Backpack when the player clicks on a Gui TextButton? The following script is placed inside the TextButton, but it will not work. Again if you can, please help me. Thank you VERY much for spending your time to correct my errors.
function mouseclick(player) if player.Backpack:FindFirstChild("Sword") then script.Parent.Text = "Already owned" wait(1) script.Parent.Text = "1000 $" else game.Lighting.Uzi:Clone().Parent = player.Backpack script.Parent.Text = "BOUGHT" wait(1) script.Parent.Text = "1000 $" end end script.Parent.MouseButton1Down:connect(mouseclick)
Try this. I never tried this, but I saw some errors.
function mouseclick(player) if (player.Backpack.Sword ~= nil) then --[[I'm guessing this is where the error was. BTW your searching for something that doesn't have any spaces, so why would u need to use FindFirstChild. Plus in this situation, I think it might make more errors.]] script.Parent.Text = "Already owned" wait(1) script.Parent.Text = "1000 $" else game.Lighting.Uzi:Clone().Parent = player.Backpack --Uzi? at line 2 it said Sword. script.Parent.Text = "BOUGHT" wait(1) script.Parent.Text = "1000 $" end end script.Parent.MouseButton1Down:connect(mouseclick)