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 » Scripting Helpers
Home Search
 

Re: Help with a simple script?

Previous Thread :: Next Thread 
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 05:18 PM
local walk = script.Parent:findFirstChild("Humanoid")

while true do
wait(math.random(1, 15))

n = math.random(1, 10)
t = math.random(1, 3)
walk.WalkToPoint = Vector3.new(math.random(1, 50),math.random(1, 5),math.random(1, 50))
if n == 1 then
wait(math.random(1, 10))
walk.Jump = true
else
end

end



The script is supposed to make a model I made move around randomly in intervals of 1 to 15 seconds, and to have a 33% chance to jump every time the script runs through. But nothing happens, and I do not get any output. It may be line 8 with WalkToPoint, because whenever I changed my model's WalkToPoint vector3 values manually, nothing happens as well.

Help?
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 05:27 PM
Tl;dr version:

So the script makes the model jump, but doesn't make it walk. Help me?
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
12 Jan 2013 05:29 PM
humanoid:MoveTo(v) should do what you want.

¬ LuaLearners Writer
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 05:34 PM
MoveTo is a vector3 right?
Report Abuse
doombringer42 is not online. doombringer42
Joined: 13 Nov 2007
Total Posts: 5445
12 Jan 2013 05:35 PM
MoveTo is a method of humanoid, and its argument is a vector3.

you call it like this:

humanoid:MoveTo(Vector3.new(1, 1, 1))

¬ LuaLearners Writer
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 05:46 PM
local walk = script.Parent:findFirstChild("Humanoid")

while true do
wait(math.random(1, 15))

n = math.random(1, 10)
t = math.random(1, 3)
walk:MoveTo(Vector3.new(math.random(1, 100),0,math.random(1, 100)))
if n == 1 then
wait(math.random(1, 10))
walk.Jump = true
else
end

end



It still will not work..?
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 06:22 PM
Bump.
Report Abuse
tuxedoman23 is not online. tuxedoman23
Joined: 24 Apr 2009
Total Posts: 4670
12 Jan 2013 11:49 PM
Bump.
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
12 Jan 2013 11:54 PM
@doom, humanoid's walkto method has a second argument

hum:MoveTo(position, part)

instead of

model:MoveTo(position)

- What have the mini-mods come to nowadays? -
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
13 Jan 2013 12:01 AM
If you're trying to get it to teleport, then use this:

local character = script.Parent
 while true do
  wait(math.random(1, 15))
  n = math.random(1, 10)
  t = math.random(1, 3)
  character:MoveTo(Vector3.new(math.random(1, 100),0,math.random(1, 100)))
   if n == 1 then
    wait(math.random(1, 10))
    walk.Jump = true
   else
  end
end

Or walking to you'd need a part to move to:

local walk = script.Parent:findFirstChild("Humanoid")
 while true do
  wait(math.random(1, 15))
  n = math.random(1, 10)
  t = math.random(1, 3)
  walk:MoveTo(Vector3.new(Workspace.Part.Position, Workspace.Part))
   if n == 1 then
     wait(math.random(1, 10))
     walk.Jump = true
    else
  end
 end
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
13 Jan 2013 12:02 AM
@cody,

* walk:MoveTo(Workspace.Part.Position, Workspace.Part)

- What have the mini-mods come to nowadays? -
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
13 Jan 2013 12:03 AM
Oops
qq
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
13 Jan 2013 12:04 AM
@op, here -

local walk = script.Parent:findFirstChild("Humanoid")

while true do
wait(math.random(1, 15))

n = math.random(1, 10)
t = math.random(1, 3)
walk:MoveTo(Vector3.new(math.random(1, 50),math.random(1, 5),math.random(1, 50)),walk.Parent.Torso)
if n == 1 then
wait(math.random(1, 10))
walk.Jump = true --Doesn't work anymore
else
end

end

- What have the mini-mods come to nowadays? -
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
13 Jan 2013 12:05 AM
"walk.Jump = true --Doesn't work anymore"

Doesn't work?
Report Abuse
CodyTheBuildingKid is not online. CodyTheBuildingKid
Joined: 13 Dec 2011
Total Posts: 4399
13 Jan 2013 12:06 AM
Ah, nevermind. It works in the command bar.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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