I am making a butterfly that flies around randomly. My issue is that the butterfly keeps on flying through the floor and disappearing. I was wondering if there was a way to restrict the area the butterfly can fly in. Here is my script
local Body = script.Parent.PrimaryPart
function move()
for i = 1, 21 do
script.Parent:SetPrimaryPartCFrame(Body.CFrame*CFrame.Angles(math.rad(math.random(-5,5)), math.rad(math.random(-5,5)), math.rad(math.random(-5,5))))
wait()
script.Parent:SetPrimaryPartCFrame(Hinge.CFrame*CFrame.new(1,0,0))
end
end
while true do
move()
end
If anyone has a way to stop it from flying everywhere or any resources I could use, that would be amazing.
