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

Doesn't clone, why?

Asked by
Tynezz 0
10 years ago

So I have the script that clones the backpacks to lighting.

game.Players.PlayerAdded:connect(function(p)
local back = Instance.new("Backpack", game.Lighting)
back.Name = p.Name
local c = Instance.new("Backpack", back)
c.Name = "CurrentCharacter"
lcoal s = game.ServerScriptService.Character:Clone()
s.Parent = back
s.Disabled = false
end)

`

That works perfectly. Now in the script called Character there is this.

s = script.Parent.CurrentCharacter:FindFirstChild("CreateCharacter")
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
check = p:WaitForChild("Backpack")
if check:FindFirstChild("CreateCharacter") then
check.CreateCharacter:Destroy()
repeat wait() until check.CreateCharacter == nil
end
if s ~= nil then
local ch = s:Clone()
ch.Parent = check
ch.Disabled = false
end
end)
end)

This doesn't function as I wanted it to. It's suppose to do this:

  1. Check if in the player's backpack check if there is a script called "CreateCharacter"
  2. If that ~=nil then, Destroy() it.
  3. Once that's done, clone a new one.
  4. If CreateCharacter was nil then, skip to cloning a new one.
  5. The createcharacter will be cloned to the player's backpack, and set disabled to false.

I have no idea what's wrong..

0
You cannot create "Backpack" it is not an instance. fireboltofdeath 635 — 10y
0
Actually you can. You can try. Tynezz 0 — 10y

Answer this question