Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

script has no errors, but won't clone tool?

game.Players.PlayerAdded:Connect(function (player)
	
	local rs = game.ReplicatedStorage
	local basic = rs.Scythe
	local aprentice = rs.AprenticeScythe
	local magma = rs.MagmaScythe
	local itemsfolder = player:WaitForChild("items")
	local item = itemsfolder:WaitForChild("Item")
	
	if item.Value == "Basic" then
		print("weapon cloned")
		local scythe = basic:Clone()
		scythe.Parent = player.Backpack
	end
	
end)

i want it to check a datastore value from my player, that says what kind of item they left off with, in this case im just having it be a basic item for now.

i want it to clone the "scythe" tool into their backpack but it wont do it

this script is located in workspace.

2 comments

0

It could also appear in starterpack, I forgot how it works.

0

Format?

2 answers

It was just a loading time situation, i added a wait(2) after declaring my variables and it was able to catch after in the if statement.

1 comment

0

Use a WaitForChild(), FindFirstChild(), etc, wait() might not always work

Its not a

scythe.Parent = player.Backpack

Its

scythe.Parent = player.StarterPack

Anyway delete everything and do this:

game.Players.PlayerAdded:Connect(function(player)

local ScytheClone = game:WaitForChild("ReplicatedStorage").Scythe:Clone()
ScytheClone.Parent = player.StarterPack

print("Weapon Cloned")

end)

1 comment

0

Actually, it's player.Backpack. Check the studio

This discussion is preserved as it was. New answers, comments, and votes are closed.