Issues with cloning

I have a script that clones a sword based on a value. This is in a round system. The sword does not clone.

for _, player in ipairs(plrs) do
		local character = player.Character
		if character and #AvailableSpawnPoints > 0 then
			character:FindFirstChild("HumanoidRootPart").CFrame = AvailableSpawnPoints[1].CFrame
			table.remove(AvailableSpawnPoints, 1)
			--Sword Clone
			if not player.Backpack:FindFirstChild("sword") then
				local swordsnum = player.Leaderstats.Swords.Sword
				if swordsnum == 1 then
					local classic = serverstorage.Swords.ClassicSword:Clone()
					classic.Parent = player.Backpack
					classic.Name = "sword"
					print("1")
				end
				if swordsnum == 2 then
					local Future = serverstorage.Swords.FutureSword:Clone()
					Future.Parent = player.Backpack
					Future.Name = "sword"
					print("2")
				end
				if swordsnum == 3 then
					local Light = serverstorage.Swords.LightSword:Clone()
					Light.Parent = player.Backpack
					Light.Name = "sword"
					print("3")
				end
				if swordsnum == 4 then
					local Dark = serverstorage.Swords.DarkSword:Clone()
					Dark.Parent = player.Backpack
					Dark.Name = "sword"
					print("4")
				end
				if swordsnum == 5 then
					local Devil = serverstorage.Swords.DevilSword:Clone()
					Devil.Parent = player.Backpack
					Devil.Name = "sword"
					print("5")
				end
				if swordsnum == 6 then
					local Doom = serverstorage.Swords.DoomSword:Clone()
					Doom.Parent = player.Backpack
					Doom.Name = "sword"
					print("6")
				end
			end

Is this done in a server script or a local script? Because if it’s local, you won’t have access to ServerStorage. Also what is your definition for “serverstorage” also did you try to do

local classic = serverstorage.Swords:WaitForChild("ClassicSword"):Clone()

It could be that the sword isn’t found in time so all you would have to do is add a “WaitForChild” statement.

1 Like

Server script. And it still does not clone.

sounds like you forgot to place .Value after checking swordsnum

correction:

if swordsnum.Value == 1 then
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.