Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago
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.

0
It could also appear in starterpack, I forgot how it works. greatneil80 2647 — 6y
0
Format? AnotherPerson_999 28 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

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.

0
Use a WaitForChild(), FindFirstChild(), etc, wait() might not always work Formidable_Beast 197 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

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)

0
Actually, it's player.Backpack. Check the studio guidable 42 — 6y

Answer this question