I’m making a game where you collect potatos and earn money, and then buy food because if your hunger and thirst bars go down, you die. I wanted to make so when you collect a potato, it is destroyed and another generated in a random location in the garden. I’m stuck here:
while wait(0.2) do
for i,v in ipairs(game.Workspace.Potatos:GetDescendants()) do
if v:IsA("ClickDetector") then
v.MouseClick:Connect(function(player)
local potatos = player.Potatos
potatos.Value = potatos.Value + 1
v:Destroy()
local Part = game.Workspace:WaitForChild("Garden"):WaitForChild("Fence"):WaitForChild("Floor")
local potatomodel = game.ReplicatedStorage.Potato:Clone()
potatomodel.Parent = game.Workspace.Potatos
potatomodel.Position = -- Stuck here .-.
end)
end
end
end
My brain is uncapable of processing very complex math equations, so I really don’t have an idea of what to do. I even tried making something out of this region3 formula
Region3.new(Part.Position-(Part.Size/2),Part.Position+(Part.Size/2))
-- to
local random = math.random(Part.Position-(Part.Size/2),Part.Position+(Part.Size/2))
potatomodel.Position = random
but it didn’t work.