generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: NPC pet follows the character, walks sideways & reverse tho

Previous Thread :: Next Thread 
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 09:01 PM
I have an NPC pet I made using a Humanoid. Basically, it has 2 parts, a MeshPart called Torso, and a Head, which is .99 Transparency and .1x.1x.1 size, and it's welded to the Torso to hold it in place. The NPC works fine, except for when I call MoveTo in the script I posted below. The NPC walks backwards, sideways, and hardly ever forwards. How can I make it so it only walks forwards? I tried rotating the Torso by 90 degrees 180 degrees and 270 degrees with no avail.


local sp = script.Parent
local torso = sp.Torso
local humanoid = sp.Humanoid
local owner = script.Parent.Owner

while wait(.1) do
if owner.Value ~= "Unclaimed" then
local find = game.Players:FindFirstChild(owner.Value)
if find ~= nil and find.Character.Torso.Velocity.X ~= 0 then
local chr = find.Character
local cTorso = chr.Torso
humanoid:MoveTo(cTorso.Position + cTorso.CFrame.lookVector * -10)
end
end
end


-iJava
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 09:08 PM
1


-iJava
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 09:45 PM
2


-iJava
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
02 Aug 2016 09:48 PM
I think your problem is that the torso's literal front side appears as a lateral side to you. A way to fix this would be to switch the torso's size dimensions so tht the width->length and length->width.
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 10:22 PM
What do you mean?


-iJava
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 10:26 PM
3


-iJava
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
02 Aug 2016 10:38 PM
Say you have a part:

[_____] <-Front side

Shrink it like this:

[_] <~~~


Then lengthen it like so:
_
| |
| |
| | <-Front side
| |
| |
|
V

Now it should look like the original 'cept the front side's longer
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 10:54 PM
Will that work with a MeshPart?


-iJava
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
02 Aug 2016 11:01 PM
Yeah, unless you have something else used to differentiate the front from the other sides.
Report Abuse
Widths is not online. Widths
Joined: 12 Aug 2014
Total Posts: 41286
02 Aug 2016 11:02 PM
Won't that completely distort the mesh though?


-iJava
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
02 Aug 2016 11:09 PM
Oh. That's what you meant lol. Maybe you could make another invis part act as the Torso?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image