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

Object not cloning to the place I want it to clone to? [SOLVED]

Asked by 4 years ago
Edited 4 years ago

The spawn area isn't cloning.

local AvailableArea = game:GetService("ReplicatedStorage").SpawnPartsForCustomize


local chosenArea = AvailableArea:GetChildren()


local mathClonedArea = chosenArea[math.random(1, #chosenArea)]

local isAble = mathClonedArea:WaitForChild("IsFilled")

local clonedArea = mathClonedArea:Clone()
clonedArea.Parent = workspace




game.Players.PlayerAdded:Connect(function(plr)
    if isAble.Value == false then
    clonedArea.Name = plr.Name.."SpawnCustom"
    clonedArea.Anchored = true
    local cloneCustomArea = game.ReplicatedStorage.CustomIzeArea
    local cloned = cloneCustomArea:Clone()
    cloned.Name = plr.Name.."'s CustomizeArea"
    cloned.CloneBrickSpawn.CFrame = game.Workspace:FindFirstChild(plr.Name.."SpawnCustom").CFrame
    cloned.Parent = workspace
    wait(.1)
    mathClonedArea:Destroy()
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

Well, since we talked in the chat, here's the code I came up with and how I explained it to you.

game.Players.PlayerAdded:Connect(function(plr)
    local AvailableArea = game:GetService("ReplicatedStorage").SpawnPartsForCustomize
    local chosenArea = AvailableArea:GetChildren()
    local mathClonedArea = chosenArea[math.random(1, #chosenArea)]

    local isAble = mathClonedArea:WaitForChild("IsFilled")
    local clonedArea = mathClonedArea:Clone()
    clonedArea.Parent = workspace

    if isAble.Value == false then
    clonedArea.Name = plr.Name.."SpawnCustom"
    clonedArea.Anchored = true

    local cloneCustomArea = game.ReplicatedStorage.CustomIzeArea
    local cloned = cloneCustomArea:Clone()

    cloned.Name = plr.Name.."'s CustomizeArea"
    cloned.CloneBrickSpawn.CFrame = game.Workspace:FindFirstChild(plr.Name.."SpawnCustom").CFrame
    cloned.Parent = workspace

    wait(0.1)
    mathClonedArea:Destroy()
    end
end)

Don't forget, if this worked select it as an answer so other people know it's been answered!

~killerbrenden

Ad

Answer this question