bigme2
|
  |
| Joined: 20 Sep 2013 |
| Total Posts: 404 |
|
|
| 04 Oct 2015 12:20 PM |
I'm working on a game called "Hurricane Survival". I made a block representing the hurricane. I want it to do this in a loop:
Step 1: Follow a random Robloxian at a speed slightly lower than the speed of a Robloxian for 10 seconds Step 2: Do the same thing, just for another Robloxian
I can figure out the ontouched scripts (like when a humanoid touches the hurricane they die), but I need help with making it move. |
|
|
| Report Abuse |
|
|
bigme2
|
  |
| Joined: 20 Sep 2013 |
| Total Posts: 404 |
|
| |
|
hamahama1
|
  |
| Joined: 25 Oct 2012 |
| Total Posts: 1559 |
|
|
| 04 Oct 2015 12:29 PM |
| This is not the forum where people make you free scripts XD |
|
|
| Report Abuse |
|
|
|
| 04 Oct 2015 01:13 PM |
to make it move, I would first grab all the players in the game using plr=game.players:getChildren()
then I would grab a random one with hurricanetrget=plr(math.random(1,#plr))
as far as moving the hurricane towards that player, it requires a little math.
You basically find the direction from the hurricane to the player and then make the hurricane move that way at a magnitude equal to it's "speed" |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 04 Oct 2015 01:32 PM |
function slide(part,goal,speed,portion) for i=1,speed*((part.Position-goal.p).Magnitude)*portion do part.CFrame=part.CFrame:lerp(goal,1/speed/((part.Position-goal.p).Magnitude)) wait() end part.CFrame=goal end
part is the part you wnt to move. goal is the CFrame of the part you want it to move toward. speed is a number, higher being faster. portion should be a number, less than one and greater than zero, representing the portion of the distance between the moving part's current position and its goal that you want it to traverse.
chasing=true while chasing do slide(Hurricane,player.Character.Head.CFrame,1,.1) wait(1) end
It will move the center of the chasing part toward the center of the chased part. Play with the numbers(speed and portion) to get it to go at the right speed. |
|
|
| Report Abuse |
|
|
bigme2
|
  |
| Joined: 20 Sep 2013 |
| Total Posts: 404 |
|
|
| 04 Oct 2015 01:33 PM |
| I came up with a strategy, so please do not answer anymore. |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 04 Oct 2015 01:39 PM |
Oh, sorry, take out
part.CFrame=goal .
It's for one I use to move it all the way. |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 04 Oct 2015 01:41 PM |
| It's okay, it's over your head anyway. Nevertheless, you're welcome. |
|
|
| Report Abuse |
|
|
bigme2
|
  |
| Joined: 20 Sep 2013 |
| Total Posts: 404 |
|
|
| 04 Oct 2015 01:56 PM |
| Actually my script didn't work. ShungTzu, I'll try your way, but how do I define player? |
|
|
| Report Abuse |
|
|