Is your crab correctly rigged?
Model Not Aviable.
Here’s my Crab. Maybe you can fix it by looking into Crab in Studio.
Have you checked my Crab in Studio, @Awesom3_Eric?
Did not look at the demo. Does your model have a PrimaryPart set? That is what MoveTo
actually moves.
EDIT: Also a protip, when posting for help try to make it easy for people to help you. Maybe post screenshots or snippets of code instead of the game. Loading up studio is quite the hassle.
You mean Model:MoveTo()
or Humanoid:MoveTo()
? I would suggest using Model:SetPrimaryPartCFrame()
if you’re using Model:MoveTo()
. If your :MoveTo()
is a Humanoid:MoveTo()
then check if the HumanoidRootPart is anchored or not. It can’t move if it’s anchored.
I did but @Awesom3_Eric didn’t know how everything works so I replaced code and Crab Explorer Structure to Crab Demo Model.
Also what do you mean by Setting Primary Part (I know how to set Primary Part but I dont know what should I set as Primary Part).
I mean Humanoid:MoveTo(). I used Model:MoveTo() but it moved my Model instantly (this is what I don’t want to achieve).
Whichever part in your model you want. It will probably work. When you use move to that part is moved and all the others are moved relative to that.
I actually recommend making something like a hit box that is transparent and covers the whole crab and setting that as a primary part.
That is also fine, but in the end, any part will do for MoveTo.
I don’t think a Humanoid will work in this situation as there are only 2 parts. Here’s why. I think you need at least 6 parts, names corrospondingly for the humanoid to work. I’m not too sure but this is what the DevHub says.
Just a guess, but this happens A LOT when I’m working even with just rigs - anchor, and then unanchor everything in the model by using the anchor button when selecting the model. Who knows, but it usually works for me when it hasn’t worked.
Oh, now I see, you mean Humanoid:MoveTo(). I was thinking of Model:MoveTo().
Make sure the crab is unanchored, also does the script error at all?
Script doesn’t error. I unanchored the Crab and still nothing.
Also Model:MoveTo() works, but I don’t want to use it. I want to use Humanoid:MoveTo() to make Crab walking not Teleporting.
Please look at the Model too and check what’s wrong with it (why it doesn’t move at all).
local tweenService = game:GetService("TweenService")
local PATROL_DELAY = 7
local MOVE_DURATION = 3
local crab = game.Workspace.CrabsAndShels.Crab1
local pointA = game.Workspace.CrabsAndShels.CrabPoints.Point1
local pointB = game.Workspace.CrabsAndShels.CrabPoints.Point2
local humanoid = crab.Humanoid
local nextDestinationObject = pointA
for _, part in ipairs(crab:GetDescendants()) do
if part ~= crab.PrimaryPart and part:IsA("BasePart") then
local Weld = Instance.new("WeldConstraint")
Weld.Part0 = part
Weld.Part1 = crab.PrimaryPart
Weld.Parent = crab.PrimaryPart
part.Anchored = false
end
end -- Weld All Parts Together to Tween Primary Part
local function moveCrab(toPart)
tweenService:Create(crab.PrimaryPart, TweenInfo.new(MOVE_DURATION), {CFrame = toPart.CFrame}):Play()
end -- Move Crab using Tween Service
local start = tick()
game:GetService("RunService").Heartbeat:Connect(function()
if tick() - start >= PATROL_DELAY then
moveCrab(nextDestinationObject)
if nextDestinationObject == pointA then
nextDestinationObject = pointB
else nextDestinationObject = pointA
end
start = tick()
end
end) -- Move Crab using Heartbeat rather that While wait() Loop (because it's bad lol)
CrabWalk.rbxl (57.9 KB)
Thanks! I have a question? How would it be possible to move the Crab towards the Player or move it Randomly? If you don’t want to answer or you don’t know how to do it etc. don’t Reply.
I believe the crab is made out of “Parts”? Use Vector3.new and do multiple of those, like this.
Vector.new(x,y,z)
wait(30)
Vector.new(x,y,z)
wait(30)
Vector.new(x,y,z)
Etc.
I used Vector3 but it doesn’t look real. Tweening is better in my opinion.
Thanks for all help!
Alright, that’s fine, sure! Good luck!