#Why isn't this script working?

1 messages · Page 1 of 1 (latest)

lunar wedge
#

local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local toolclone = RS:FindFirstChild("Clonetools")

players.PlayerAdded:connect(function(player)
local playerBP = player:WaitForChild("Backpack")

for _, i in ipairs(toolclone:GetChildren()) do
    if i:IsA("Tool") then
        i:Clone().Parent = playerBP
    end
end    

end)

weary wharf
#

are there any errors in the output log? if so, can you send them here?

slim sequoia
#

local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local toolclone = RS:FindFirstChild("Clonetools")

players.PlayerAdded:Connect(function(player) -- Capital "C" in Connect
local playerBP = player:WaitForChild("Backpack")

for _, i in ipairs(toolclone:GetChildren()) do
    if i:IsA("Tool") then
        i:Clone().Parent = playerBP
    end
end

end)

lunar wedge
#

still an't working

#

theres no error in output

#

goal: clone everything inside clonetool and set it's parent as the player backpack

ivory turretBOT
#

studio** You are now Level 1! **studio

rose night
#

hmmmm.. maybe try adding some print statements in the for loop to double check that its actually running

hollow crypt
#

@lunar wedge can you try printing some stuff

lunar wedge
#

alr

hollow crypt
#
local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local toolclone = RS:FindFirstChild("Clonetools")

players.PlayerAdded:connect(function(player)
    print("Player ", player, "Joined!")
    local playerBP = player:WaitForChild("Backpack")

    for _, i in ipairs(toolclone:GetChildren()) do
        print(i)
        if i:IsA("Tool") then
            print("Tool ", i)
            i:Clone().Parent = playerBP
        end
    end
end)```
#

@lunar wedge try that

lunar wedge
#

alr

hollow crypt
#

and then send a screen shot of console

lunar wedge
#

it says it has been cloned but hasn't

hollow crypt
#

where is your script? @lunar wedge

lunar wedge
#

serverscriptservice in a folder

#

its a script

hollow crypt
#

mabye try this so we have some more prints

local RS = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")

local toolclone = RS:FindFirstChild("Clonetools")

players.PlayerAdded:connect(function(player)
    print("Player ", player, "Joined!")
    local playerBP = player:WaitForChild("Backpack")

    for _, i in ipairs(toolclone:GetChildren()) do
        print(i)
        if i:IsA("Tool") then
            print("Tool ", i, "With Parent ", i.Parent)
            clonedTool = i:Clone()
            print("Cloned Tool ", clonedTool.Name, "With Parent ", clonedTool.Parent)
            clonedTool.Parent = playerBP
            print("Set ", clonedTool.Name, " Parent To ", clonedTool.Parent)
        end
    end
end)```
#

@lunar wedge it will print the cloned tool and then its parents

#

just in case yk as this doesnt make sense

lunar wedge
hollow crypt
#

oaky try this for me @lunar wedge

Players.PlayerAdded:Connect(function(player)
    print("Player", player.Name, "joined!")

    player.CharacterAdded:Connect(function(character)
        print("Character Connected")
        local backpack = player:WaitForChild("Backpack")

        for _, tool in ipairs(toolclone:GetChildren()) do
            if tool:IsA("Tool") then
                print("Tool", tool.Name, "With Parent", tool.Parent)
                local clonedTool = tool:Clone()
                print("Cloned Tool", clonedTool.Name, "With Parent", clonedTool.Parent)
                clonedTool.Parent = backpack
                print("Set", clonedTool.Name, "Parent To", clonedTool.Parent)
            end
        end
    end)
end)```
#

because it could be that they havemt loaded in

lunar wedge
#

YASSSSSSS IT WORKS

#

THX

#

SO MUCH

hollow crypt
#

okay good

#

no problem

lunar wedge
#

what did you change

hollow crypt
#

added player.CharacterAdded:Connect(function(character)