I’m currently trying to make a turtle swim around randomly inside a certain area. I’m having the fish use bodyposition to move around, yet the bodyposition doesn’t seem to work and just drops the turtle through the floor. Here is the script I’m using to set the bodyposition.Position value, a video of the problem happening, and a picture of the turtle model in the explorer as I believe it could have something to do with the model itself and not the script.
local RunService = game:GetService("RunService")
script.Parent.BodyPosition.Changed:Connect(function(change)
repeat RunService.Heartbeat:Wait() until (script.Parent.Position - script.Parent.BodyPosition.Position).Magnitude < 25
local Part = game.ReplicatedStorage.Regions.SanctuaryBorder.WholeArea
local Pos = Part.CFrame * CFrame.new(math.random(-Part.Size.X/2, Part.Size.X/2),math.random(-Part.Size.Y/2, Part.Size.Y/2),math.random(-Part.Size.X/2, Part.Size.X/2))
script.Parent.BodyPosition.Position = Pos.Position
script.Parent.CFrame = CFrame.new(script.Parent.Position, Pos.Position)
end)
local Part = game.ReplicatedStorage.Regions.SanctuaryBorder.WholeArea
local Pos = Part.CFrame * CFrame.new(math.random(-Part.Size.X/2, Part.Size.X/2),math.random(-Part.Size.Y/2, Part.Size.Y/2),math.random(-Part.Size.X/2, Part.Size.X/2))
script.Parent.BodyPosition.Position = Pos.Position
script.Parent.CFrame = CFrame.new(script.Parent.Position, Pos.Position)
The parts model is just full of the “LargeCrystalCartoony” parts, as well as the “Sea Turtle” part.
