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
 

How to make a target fly inversedto a derection he was shot?

Previous Thread :: Next Thread 
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
01 Jul 2013 11:58 AM
function OnTouch(hit)
        if debounce == false then
            debounce = true
    val = Instance.new("NumberValue", script)
    hum = hit.Parent:FindFirstChild("Humanoid")
    --hum.Parent:MoveTo(hum.Parent.Torso.Position + Vector3.new(0, 10, 0)) -- This part. I need the target fly away inversed as he was shot
    hum.Parent.Torso.Anchored = false
    while true do
        val.Value = val.Value + 1
        hum.Parent:MoveTo(hum.Parent.Head.Position + Vector3.new(1, 0, 0)) -- Attempt, but he flies to one direction only.
        wait()
        if val.Value == 50 then
            break end end
        hum:TakeDamage(20)
        val:remove()
        end
        debounce = false
        end
    end
    Tool.Handle.Touched:connect(OnTouch)

How to make it fly away from the player that hit the target? I have no idea how this method is called, or how to search in wiki, but if you could, please send some script lines about it
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
01 Jul 2013 12:35 PM
I also tried

hum.Parent:MoveTo(hum.Parent.Torso.CFrame == me.Torso.CFrame():inverse())

but still, gives me an error.
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:19 PM
Ok first of all rename the function to onTouch and in the connection line. It is just plain irritating me. Next, double check the vector values and make sure they are what you want.

~-Scripting can make ANYTHING-~
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:20 PM
Oh and also you need to learn about bodyvelocity and that sort a stuff. I specialize in GUI's so I can only help you a little bit with this sort of subject.
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:21 PM
OH and also you forgot an end here
" if debounce == false then
debounce = true "
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:23 PM
And finally, when you do this line, "val = Instance.new("NumberValue", script)" try to set the parent of the number value in a new line. Such as "val.Parent = game.Workspace.script" or whatever the name is of your script. Also rename the script.
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:26 PM
Man, are there a lot of errors..... Ok next is these two lines.

" --hum.Parent:MoveTo(hum.Parent.Torso.Position + Vector3.new(0, 10, 0)) "

" hum.Parent:MoveTo(hum.Parent.Head.Position + Vector3.new(1, 0, 0)) "

Remove the double parenthesis plox
Report Abuse
GameProgramming is not online. GameProgramming
Joined: 27 Jun 2013
Total Posts: 39
01 Jul 2013 01:26 PM
Oh and lastly, you forgot t set the wait timer....
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
01 Jul 2013 02:07 PM
The script I wrote works PERFECTLY, I'd know if there are errors. I just need somebody to explain how to Push the target away from creator
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
01 Jul 2013 02:10 PM
Simplest way is to create a BodyForce.
You also need to use .lookVector or the player's head/torso/whatever and assign a value negative to where he is facing.
Report Abuse
gansest is not online. gansest
Joined: 08 Apr 2010
Total Posts: 609
01 Jul 2013 02:29 PM
uh... I'll try that. Sounds complicated.
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