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: Creation of a moving npc

Previous Thread :: Next Thread 
bublgmdude is not online. bublgmdude
Joined: 26 Apr 2008
Total Posts: 2248
17 Apr 2015 01:05 AM
I am currently trying to make an exact copy of my players npc to add into my game. My main goal is to create some nice looking npcs to just walk around my boat dock and have a message on top of their head. Im sorry if this is the wrong forum to post this but im just trying to learn a little about npcs. If anyone can help me or give me some pointers that would be great thanks.
Report Abuse
bublgmdude is not online. bublgmdude
Joined: 26 Apr 2008
Total Posts: 2248
20 Apr 2015 11:04 AM
bump
Report Abuse
NovusTheory is not online. NovusTheory
Joined: 14 Oct 2009
Total Posts: 4532
20 Apr 2015 11:15 AM
Can you specify what "exactly" you want to know about them?
Report Abuse
Atoshi is not online. Atoshi
Joined: 20 Nov 2008
Total Posts: 92
20 Apr 2015 11:24 AM
How do you want it to move?

First 'Play Solo' and copy the head, right arm, right leg, left arm, left leg, humanoid and the animations then click stop and paste it. Then add this script:

local CurrentPart = nil
local MaxInc = 20

function onTouched(hit)
if hit.Parent == nil then
return
end

local humanoid = hit.Parent:findFirstChild("Humanoid")

if humanoid == nil then
CurrentPart = hit
end
end

function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)

if child then
return child
end

while true do
print(childName)

child = parent.ChildAdded:wait()

if child.Name==childName then
return child
end
end
end

local Figure = script.Parent
local Humanoid = waitForChild(Figure, "Humanoid")
local Torso = waitForChild(Figure, "Torso")
local Left = waitForChild(Figure, "Left Leg")
local Right = waitForChild(Figure, "Right Leg")

Humanoid.Jump = true

Left.Touched:connect(onTouched)
Right.Touched:connect(onTouched)

while true do
wait(math.random(2, 6))

if CurrentPart ~= nil then
if math.random(1, 2) == 1 then
Humanoid.Jump = true
end

Humanoid:MoveTo(Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
end
end
Report Abuse
Atoshi is not online. Atoshi
Joined: 20 Nov 2008
Total Posts: 92
20 Apr 2015 11:25 AM
This isn't probably how you want it to move. But you can change it yourself.
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