What do you want to achieve?
I have a tool giver that is supposed to give the player a tool from ServerStorage. When a player uses the giver however it gives the player the original tool instead of the cloned tool.
What is the issue?
This creates a problem because if I were to destroy the tool in the player’s backpack/inventory then the original tool won’t be in ServerStorage anymore as it’d be destroyed.
What solutions have you tried so far?
I’ve tried searching the DevForum but I struggled to find a post that was specific to my situation. I also have tried rewriting my script but I’m not very confident in my abilities (as I’m very new to scripting) and nothing works.
I was wondering if you could also help me with this related problem:
How would I delete the cloned tool from the player’s backpack? Once I “give” the tool to the NPC, I’d like the tool removed from their backpack but not the ServerStorage?
My script isn’t working
local pizzatool = game.Players.LocalPlayer.Backpack["Pupperoni Pizza"]
local pizza = game.Workspace.PupperoniPizza
local prp = script.Parent
local customer = prp.Parent
script.Parent.Triggered:Connect(function(player)
if game.StarterPlayer["Pup Pizza"].Value == true then
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 25
game.StarterPlayer["Pup Pizza"].Value = false
pizzatool.Cheese.Transparency = 1
pizzatool.Toppings.Transparency = 1
pizzatool:Destroy()
end
end)
I was wondering if you could maybe help me with this related problem?
How would I delete the cloned tool from the player’s backpack? Once I “give” the tool to the NPC, I’d like the tool removed from their backpack but not the ServerStorage?
My script isn’t working
local pizzatool = game.Players.LocalPlayer.Backpack["Pupperoni Pizza"]
local pizza = game.Workspace.PupperoniPizza
local prp = script.Parent
local customer = prp.Parent
script.Parent.Triggered:Connect(function(player)
if game.StarterPlayer["Pup Pizza"].Value == true then
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 25
game.StarterPlayer["Pup Pizza"].Value = false
pizzatool.Cheese.Transparency = 1
pizzatool.Toppings.Transparency = 1
pizzatool:Destroy()
end
end)
Try this if i am understanding what you are trying to do
local Player = game.Players.LocalPlayer
local pizza = game.Workspace.PupperoniPizza
local prp = script.Parent
local customer = prp.Parent
script.Parent.Triggered:Connect(function()
if game.StarterPlayer["Pup Pizza"].Value == true then
Player.leaderstats.Money.Value = Player.leaderstats.Money.Value + 25
game.StarterPlayer["Pup Pizza"].Value = false
local pizzatool = Player.Backpack:FindFirstChild("Pupperoni Pizza") or Player.Character:FindFirstChild("Pupperoni Pizza")
if pizzatool then
pizzatool.Cheese.Transparency = 1
pizzatool.Toppings.Transparency = 1
pizzatool:Destroy()
end
end
end)