Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My script is only cloning once and not in the right position?

Hi I am trying to clone a model from replicated storage and spawn it in the game at a certain point, but it only spawns the spider once and doesn't spawn it in the right position. Here is my code

local offset = Vector3.new(0,0,5)
while true do
	wait()
	if myHuman.Health <= 250 then
		outerStomach.Transparency = 1
		splat:Play()
		scream:Play()
		boomAnim:Play()
		for i = 1,5 do
			local spider = game.ReplicatedStorage:FindFirstChild("Spider")
			local spiderclone = spider:Clone()
			spiderclone.Parent = workspace
			spiderclone.Cframe = outerStomach.Cframe*offset
			print("Spawned")
		end
		break
	end
end

2 answers

on line 13

 spiderclone.Cframe = outerStomach.CFrame*offset

capital CFrame

1 comment

0

I did that thank you, but this didn't solve the problem

local offset = Vector3.new(0,0,5)
myHuman.Changed:Connect(function()
    if myHuman.Health <= 250 then
        outerStomach.Transparency = 1
        splat:Play()
        scream:Play()
        boomAnim:Play()
        for i = 1,5 do
            local spider = game.ReplicatedStorage:FindFirstChild("Spider")
            local spiderclone = spider:Clone()
            spiderclone.Parent = game.Workspace
            spiderclone.Cframe = outerStomach.Cframe*offset --Not sure if this is a part or a model but if it's a model, make sure to to get the main part of the spider so it can CFrame hope
            print("Spawned")
        end
    end
end)

I changed some things, not sure about the CFrame spider thing though since I don't know if "spiderclone" is a part or a model. Hope this helps

This discussion is preserved as it was. New answers, comments, and votes are closed.