I'm making a little fruit picking minigame where apples are automatically added to your basket stored in your inventory as soon as you pick them (not actively held out, because the apples use a ClickDetector).
The position of the apples should be randomizing here, but they aren't, i don't know why, does anyone else know?
local Basket = script.Parent
Basket.Items.ChildAdded:Connect(function(Child)
print(Child)
Child.Handle.Position = Basket.Handle.Position + Vector3.new(math.random(-0.5, 0.5), #Basket.Items:GetChildren() / 10 + 0.5, math.random(-0.5, 0.5)) --X and Z do not randomize, however the Y value does change correctly
Child.Handle.Orientation = Vector3.new(math.random(0, 360), math.random(0, 360), math.random(0, 360))
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Basket.Handle
Weld.Part0 = Basket.Handle
Weld.Part1 = Child.Handle
end)
First image: a stupid and ugly clump of apples that should be more spread out
Second image: location of all relevant instances in the explorer
** You are now Level 2! **