I'm making a game where you can place fields for crops and was wondering how to make the next stage of growing spawn in at the right place by finding the position of the last stage
✓ ANSWER ACCEPTED
How to make something spawn at a point from replicated storage?
1 answer
✓ Accepted answer
You could do something like:
local RS = game:GetService("ReplicatedStorage")
local crops = RS:WaitForChild("Crops") --folder of crop stages
function newgrowthstage(originalobj, stagenm)
--gets new crop with the name of whatever stagenm is
local newcrop = crops:WaitForChild(stagenm):Clone()
newcrop.Parent = workspace
--sets cframe to the previous stage's cframe, where the previous stage is originalobj
newcrop.CFrame = originalobj.CFrame
--destroys the previous stage
originalobj:Destroy()
end
Though you'll have to keep track of the objects somehow, perhaps an array that keeps track of both the actual model/part and what stage it is currently at.
This discussion is preserved as it was. New answers, comments, and votes are closed.
