Below is a part of a game script.
There is a value inside player named PersonalSword which carries the string value of the kind of sword that the character will be provided with.
Scheduledsword is the stringvalue of personalsword, which carries the same string value as a sword in ReplicatedStorage.
The problem is I can't get the player to obtain the sword more than once.
On the first time, the script works, but when the second time comes to appear with the sword, I get this message:
"Workspace.GameScript:57: attempt to index local 'scheduledsword' (a nil value)"
function InsertSwords()
for i, v in pairs(game.Players:GetPlayers()) do
local playersword = v:WaitForChild("PersonalSword")
local scheduledsword = game.ReplicatedStorage:FindFirstChild(playersword.Value)
scheduledsword.Parent = v:WaitForChild("Backpack")
end
end

1 comment
Did you mean to clone the sword and put the clone in the players' backpack?