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

Why are my clones not cloning to my parts Cframe?

Hello, i have an issue with my script not cloning to the part, but to a random position on baseplate.

local spawnPoint = script.Parent
local human = game.ServerStorage.Enemies.Zombie

game.Workspace.Part1.Touched:Wait()
	for count = 1,5,1 do
 		local Clone = human:Clone()
 		Clone.UpperTorso.CFrame = spawnPoint.CFrame
 		Clone.Parent = workspace
 		print("Cloned")
		wait(5)
	end
	
	game.Workspace.Iteration.Value = game.Workspace.Iteration.Value + 0.1

I have this very same script duplicated to 9 other parts. (If someone knows a better way to do i would appreciate that also)

2 comments

0

What is the PrimaryPart of the zombie model

0

Instead of having the same script in 9 different parts, use the ROBLOX Collection service! It was made for this exact reason: https://www.youtube.com/watch?v=-oPE0PL2Zew

1 answer

✓ Accepted answer

When changing the CFrame of an object, it doesn't let you just do Object.CFrame = Thing.CFrame.

You have to do:

Object.CFrame = CFrame.new(Vector3 Position)

Also, when using a for loop with an increment of one, you don't need to specify the increment. Which means you could do for count = 1, 5 do.

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