Hi! So I have a dog that will attack something from a specific place. But the problem is that the dog keeps falling over. Is there anyway to avoid this?
local mob = script.Parent
local replicatedStorage = game:GetService("ReplicatedStorage")
local chickens = replicatedStorage:WaitForChild("Chickens")
local coolDown = 5
local attackAnim = mob:WaitForChild("AnimationController"):WaitForChild("Animator"):LoadAnimation(mob:WaitForChild("AttackAnim"))
if mob.Parent:IsA("Folder") then
while wait(coolDown) do
for i,v in pairs(mob.Parent:GetChildren()) do
if chickens:FindFirstChild(v.Name) then
if v:FindFirstChild("Humanoid") then
local cframe = CFrame.new(mob.Parent.FarmerPlacements[mob.Name].Position, v.PrimaryPart.Position)
mob:SetPrimaryPartCFrame(cframe)
v:FindFirstChild("Humanoid"):TakeDamage(5)
attackAnim:Play()
wait(attackAnim.Length)
mob:SetPrimaryPartCFrame(cframe)
end
end
end
end
Try making all its parts have the custom physical properties of 100 density, 0 elasticity, and 100 ElasticityWeight. If you want to put it in a script/the command bar, do this:
local des = MODEL:GetDescendants()
for i=1,#des do
if des[i]:IsA("BasePart")then
des[i].CustomPhysicalProperties = PhysicalProperties.new(100,0.3,0,1,100)
end
end
Why would I need a body velocity? And if I do how would I use it on a mob? I want something that can make it stay in place but still be able to move and cancollide is off
If you set its velocity to (0, 0, 0), it can emulate the Anchored property without anchoring it. It will still be able to move and stay in place (I think?)
bodyvelocity set to Vector3.new(0,0,0) will make the part not get affected by physics, BUT can still be freely moved around, if you dont want that to happen, i would reccomend a BodyPosition