Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3712

Unable to clone and move the clonned model. (Roblox Studio)

$
0
0

I was trying to make an script that everytime someone subscrive to my Youtube channel, the parent (an noob model) gets cloned and teleported 8 studs UP, but that just dont work or just spawns the clone inside the original model.

Can someone help me please?

Also, please PLEASE sorry if the code is hard to understand, thats because all the coments are in another language (Brazilian Portuguese).

Here is my current LUA script:

--!strictprint("[YTLiveSubs]: Script inserido...")local http = game:GetService('HttpService')local channel_id = 'UCA4yZCVHlHZVknfesTU3XOg'local url = 'https://api.socialcounts.org/youtube-live-subscriber-count/'..channel_idlocal decodedlocal subslocal diffsubslocal datalocal successlocal finaldiffsubs -- aquele negócio que mostra a diferença de incritos.-- Pingif script:GetAttribute("Debug") == true then -- Checa se o modo "Debug" foi ativado    print("[YTLiveSubs]: Iniciando teste de ping!...")    local startTime = os.clock()    local success, response = pcall(function()        return http:GetAsync("https://www.google.com")    end)    if success then        local deltaTime = os.clock() - startTime        print("Pong!: " .. deltaTime .. " segundos")    else        print("Erro: " .. response)    endend-- Fim do Pingfunction ChecarInscritos()success,data = pcall(function()    return http:GetAsync(url)end)    --if data then    decoded = http:JSONDecode(data)    subs = decoded["est_sub"]    print(subs)    --endendprint("[YTLiveSubs]: Calculando First-run...")ChecarInscritos()while true do    diffsubs = subs    wait(3) -- em resumo, eu coloquei isso para não sobrecarregar a API    -- Eu podia tranquilamente não ter feito isso, ou mudade o cooldown para 0.1 ou 0.5,    -- Mas a API épública e eu não quero estragar o uso das outras pessoas. - PatoFlamejanteTV    ChecarInscritos()    print("[YTLiveSubs]: Inscritos atuais: " .. subs)    --print("Pong!") -- Avisa que um novo "tick"    print("[YTLiveSubs]: Novos inscritos: ".. subs - diffsubs) --matemáticas :nerd:    finaldiffsubs = subs - diffsubs    for i = 1, finaldiffsubs do        local clone = game.Workspace.Noob:Clone()        clone.Parent = game.Workspace        local ogposition = script.Parent        clone:PivotTo((0), (ogposition.PrimaryPart.CFrame - (Vector3.yAxis * 4)), (0))        --clone:MoveTo(Vector3.new(0, 10, 0)) -- move 10 studs up in the y-axis from the origin        clone.Name = "Noob"..i -- os "..i"s/"..i"ses (sla o plural) é pra fazer um        clone.Humanoid.DisplayName = "Noob"..i -- efeito de "Noob1", "Noob2", etc.        --clone.Humanoid.WalkSpeed = 16        --clone.Humanoid.JumpPower = 50        --clone.Humanoid.MaxHealth = 100        --clone.Humanoid.Health = 100        --clone.HumanoidRootPart.CFrame = game.Workspace.Noob.HumanoidRootPart -- nem eu sei o que é isso        end    print("[YTLiveSubs]: Spawned ".. finaldiffsubs .." Noobs!")end

Viewing all articles
Browse latest Browse all 3712

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>