#Tool giver not working

7 messages · Page 1 of 1 (latest)

stray sonnet
#

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

#

this is the script, and I think the player is wrong

#

if player then
local clonedTool = tool:Clone()
clonedTool.Parent = player.Backpack
print("Lo strumento è stato aggiunto allo StarterPack del giocatore: " .. player.Name)
end

#

this is the part that is not working

blazing rose
#

Mind showing how everything looks from the explorer?

blazing rose
# stray sonnet wdym

The explorer.
A tool where you have all of the game instances listed such as parts inside workspace