BOOC2002
(BOOC2002)
April 3, 2023, 8:12pm
#1
What do you want to achieve? so that the part spawns in the “spawn AREA” but not where I put the part in workspace
What is the issue? code
local obj = Part:Clone()
another code
obj.Parent = game.Workspace.spawnArea
What solutions have you tried so far? I didn’t find it at all, I know that this is a child’s mistake, but I can’t find it
You need to specify the position. Just by specifying the parent doesn’t actually do anything, you’ve only parented it, not actually set its position.
Simply declare its position by doing
obj.Position = game:GetService("Workspace").spawnArea.Position
spawnArea
is a folder. You need to have a place where you want this cloned part to go.
BOOC2002
(BOOC2002)
April 3, 2023, 8:24pm
#5
like this?
obj.Position = game:GetService("Workspace").spawnArea.Part.Position
Yup. Just make sure that Part is anchored so that it can’t be moved or anything.
BOOC2002
(BOOC2002)
April 3, 2023, 8:27pm
#7
After that, I wrote everything, it does not appear at all, but there is no error
Where is game:GetService("Workspace").spawnArea.Part
? Is it where you want it to be? Did you anchor both the cloned part and this part?
BOOC2002
(BOOC2002)
April 3, 2023, 8:33pm
#10
Right I want to specify that they appear in the spawn Area
Can you send me a screenshot of your workspace in game? Show the spawnArea
folder, if you can.
BOOC2002
(BOOC2002)
April 3, 2023, 8:40pm
#12
What did you mean to show the process itself?
No, the Explorer window. My bad, I wasn’t clear enough.
BOOC2002
(BOOC2002)
April 3, 2023, 8:44pm
#14
sorry for waiting bad internet
You need to also set the parent to game:GetService("Workspace").spawnArea
otherwise, it’ll stay in SSS and won’t be replicated to workspace.
BOOC2002
(BOOC2002)
April 3, 2023, 8:48pm
#16
And how to do it? (I am just learning)
As you did before. This is the full code, if you wanted it.
local obj = Part:Clone()
obj.Parent = game:GetService("Workspace").spawnArea
obj.Position = game:GetService("Workspace").spawnArea.Part.Position
BOOC2002
(BOOC2002)
April 3, 2023, 9:01pm
#18
Wow its work but I forgot to mention that when they spawn in different random positions And I have no idea how to make them do it.
but i have idea
local spawnArea = game.Workspace.spawnArea
local obj = Part:Clone()
local randomPosition = spawnArea.Position + Vector3.new(math.random(-spawnArea.Size.X / 3, spawnArea.Size.X /3 ), 3, math.random(-spawnArea.Size.Z / 3, spawnArea.Size.Z / 3 ))
obj.Parent = game:GetService("Workspace").spawnArea
obj.Position = game:GetService("Workspace").spawnArea.Part.Position
obj.Position = randomPosition
yes that should work
you can get rid of
obj.Position = game:GetService("Workspace").spawnArea.Part.Position
since you are going to change it in the next line anyway.
BOOC2002
(BOOC2002)
April 3, 2023, 9:38pm
#21
I found a solution to the problem but I have a question How to create a string that if Parttest:clone() == 20 then
parttest:delet()