local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local scriptParent = script
local numberValue = scriptParent:FindFirstChild("Value")
if numberValue and numberValue:IsA("NumberValue") then
local toolFolder = ReplicatedStorage:FindFirstChild("ToolFolder")
if toolFolder then
local toolNumber = numberValue.Value
local tool = toolFolder:FindFirstChild("Tool" .. toolNumber)
if tool then
print("Lo strumento trovato è: " .. tool.Name)
local playerCharacter = scriptParent.Parent
if playerCharacter and playerCharacter:FindFirstChildOfClass("Humanoid") then
local player = Players:GetPlayerFromCharacter(playerCharacter)
if player then
local clonedTool = tool:Clone()
clonedTool.Parent = player.Backpack
print("Lo strumento è stato aggiunto allo StarterPack del giocatore: " .. player.Name)
end
end
else
print("Non esiste uno strumento con il nome: Tool" .. toolNumber)
end
else
print("Non esiste una cartella degli strumenti in ReplicatedStorage.")
end
else
print("Non esiste un NumberValue come figlio dello script.")
end