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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Projectile Question

Previous Thread :: Next Thread 
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:50 PM
How would I make it so when an arrow hits an AI it makes the AI follow the person who shot the arrow? Here is the script in the arrow in case you need info...

pellet = script.Parent
damage = 1
local debounce = false


function onTouched(hit)
if debounce == false then
debounce = true
if welded == false and hit.Parent:findFirstChild("Arrow") == nil then stick(hit) end
humanoid = hit.Parent:findFirstChild("Enemy")
if humanoid~=nil then
tagHumanoid(humanoid)
humanoid.Health = humanoid.Health - damage
script.Parent:Destroy()
wait(2)
untagHumanoid(humanoid)
else
wait(2)
connection:disconnect()
end
end
debounce = false
end

function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = pellet:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid

end
end


function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then

tag.Parent = nil
end
end
end

connection = pellet.Touched:connect(onTouched)

wait(1)
if welded then wait(1) end
pellet.Parent = nil



Any clues?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:53 PM
No help..
WHy doesn't anyone help me? :|
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:54 PM
I'll change Luas opening line a little by adding a question mark.


Hello world?

Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:55 PM
Ugh. :(
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:56 PM
This is starting to upset me.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:57 PM
D:
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:58 PM
Are you kidding me..?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:59 PM
Ninjasheep, scacman, ultralegomaster, woodstauk, SOMEONE!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 06:59 PM
:'(
I cannot figure it out. No clue. D:
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:00 PM
*cries like a baby* I know I fail. :|
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:01 PM
Last bump..please help..
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:08 PM
Please...
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:11 PM
YOU HAVE TO BE KIDDING ME!
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:13 PM
My gosh please... :(
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:16 PM
O
M
G
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:17 PM
y u no post
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:19 PM
:''''''''''''''''''''''''''''''(
Report Abuse
someperson23 is not online. someperson23
Joined: 04 Nov 2008
Total Posts: 1730
28 May 2012 07:26 PM
I'd help but I dunno how.
Report Abuse
C0D3Y is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
28 May 2012 07:27 PM
Well, I don't really have the life in me to physically change your script, but here's what you need to know. Most people would use :MoveTo(). That's what I would use. Check who shot the arrow, then make the AI follow the player using a loop and the :MoveTo() method. If you don't understand, look up some zombie scripts and they'll work.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:29 PM
How would I check who shot the arrow?
Report Abuse
C0D3Y is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
28 May 2012 07:31 PM
Same way as leaderboards check who shot the bullet when a player dies. You put a value into the AI when the arrow hits it, then the AI follows the value. Value being the character's name.
Report Abuse
Lucky13tm is not online. Lucky13tm
Joined: 02 May 2010
Total Posts: 436
28 May 2012 07:47 PM
Interesting
Report Abuse
1Topcop is not online. 1Topcop
Joined: 09 Jun 2009
Total Posts: 6635
28 May 2012 07:50 PM
Before making something that advanced, start small scale.
Part = Instance.new("Part",script)
Hint = Instance.new("Hint",script)
Part.Anchored = true
Part.Touched:connect(function(h)
h.Text = "The last one to touch the brick was "..tostring(game.Players:GetPlayerFromCharacter(h.Parent))
end)
Report Abuse
silverfire17 is not online. silverfire17
Joined: 28 Jan 2012
Total Posts: 42
28 May 2012 07:51 PM
What's this "stick" function?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 May 2012 07:58 PM
1Top. I am not dumb. Before you go blabering that I know nothing how about scripting you make the script. :)
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