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: Delayed Following Brick

Previous Thread :: Next Thread 
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
22 Nov 2013 06:40 PM
My goal is to make a brick follow a character's torso. But the twist is, it is 5 seconds behind. For example, let's say the character's torso is at (0, 0, 0) then he walks to (160, 0, 0). --(assuming that it takes 10 seconds for the player to walk 160 studs) So, as the player moves, the brick is in the EXACT position the player's torso was 5 seconds ago.

Any ideas? I only need to know how to do the Time delay part of it.
Report Abuse
CodTranzitZombies is not online. CodTranzitZombies
Joined: 10 Dec 2012
Total Posts: 764
22 Nov 2013 06:42 PM
That's like a zombie chasing a humanoid. It's really easy i would dig in models and get rid of bad stuff.
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
22 Nov 2013 06:45 PM
I'm not wanting a zombie script, and zombie scripts don't do exactly what I asked...
Report Abuse
CodTranzitZombies is not online. CodTranzitZombies
Joined: 10 Dec 2012
Total Posts: 764
22 Nov 2013 06:46 PM
Well in the zombie, theres a chase script, I'll see if I could edit it.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
22 Nov 2013 06:48 PM
You can use the

MoveTo method of the humanoid. It will not be delayed by 5 seconds...But it is usually delayed.
Report Abuse
CodTranzitZombies is not online. CodTranzitZombies
Joined: 10 Dec 2012
Total Posts: 764
22 Nov 2013 06:49 PM
try this:local larm = script.Parent:FindFirstChild("Left Arm")
local rarm = script.Parent:FindFirstChild("Right Arm")

function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = 99999
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("Right Arm")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end




while true do
wait(math.random(1,5))
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.Humanoid:MoveTo(target.Position, target)
end

end
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
22 Nov 2013 06:50 PM
I just want to know the delay part. I know how to make the brick go to the torso position, but I don't know how to make it be five seconds behind
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
22 Nov 2013 06:51 PM
@not

The point of the brick is to be delayed...


@tranzit

Ill try it
Report Abuse
REM25 is online. REM25
Joined: 28 Feb 2010
Total Posts: 3154
22 Nov 2013 06:55 PM
@cod I think that is from a free model...
Report Abuse
CodTranzitZombies is not online. CodTranzitZombies
Joined: 10 Dec 2012
Total Posts: 764
22 Nov 2013 06:56 PM
Ever notice? It should be noticeable, I just thought about it..
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
24 Nov 2013 12:24 PM
I have been thinking, and I think that slowing the following brick's speed would do the same thing. So, is there any way I could slow the brick's movement? I think I would need to use BodyPos, right?
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
24 Nov 2013 12:46 PM
Bananas...I mean...bump
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
24 Nov 2013 12:48 PM
Just weld it 16 * 5 studs away?
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
24 Nov 2013 01:58 PM
@cnt

That doesn't delay it's position time-wise, that just puts it 160 studs away
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
24 Nov 2013 02:07 PM
I know of a way, but I don't know how to do it...

I need to record the position of the torso, and those recordings last for 5 seconds, then are replaced. I'm thinking this:

I will need 100 X, 100 y, and 100 z recorders(to recore the position of the torso every 0.05 seconds)
And a script

I will use this... I will go see if this idea of mine works
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
24 Nov 2013 02:15 PM
shouldn't a chase script with a simple wait() do the trick?
Report Abuse
TheJKM98 is not online. TheJKM98
Joined: 20 Dec 2010
Total Posts: 511
24 Nov 2013 02:22 PM
Well, think about it, if the player cuts a sharp corner and a wall, the brick will be stuck in the wall
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
24 Nov 2013 02:24 PM
you could use a pathfinding algorithm for that.
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