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 » Scripters
Home Search
 

Re: BackStab script if anyone needs it

Previous Thread :: Next Thread 
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
13 Jul 2015 01:55 PM
I find people often making team fortress scripts and asking for backstab scripts i know i could have used math.acos and :Dot() function but i did not
want to have to use degrees.

function dotProduct(a,b)
return a.x*b.x+a.y*b.y+a.z*b.z --search it up
end

tool=script.Parent
sword=tool.Handle;
sword.Touched:connect(function(hit)
if hit.Parent ~= tool.Parent then
humanoid=hit.Parent:findFirstChild("Humanoid")
vCharacter=tool.Parent
TorsoPos=hit.Parent.Torso.Position --the torso of the guy you're about kill
vTorsoPos=vCharacter.Torso.Position --your torso
Player=Game.Players:GetPlayerFromCharacter(hit.Parent)
vPlayer=Game.Players:GetPlayerFromCharacter(vCharacter)
if Player.TeamColor ~= vPlayer.TeamColor then end
humanoid.Died:connect(function()
local distance=vTorsoPos-TorsoPos
local normDistance=distance/distance.magnitude
local dp=dotProduct(normDistance,humanoid.Torso.CFrame.lookVector)
print(dp)
if dp < -0.2665 then --[[ increase the value to
local m=Instance.new("Message") increase the range of a
m.Parent=game.Workspace backstab as long as the value
m.Text="BACKSTAB!!!" is not 0 or greater than 0
wait(2) you should be fine --]]
m:Destroy()
end
end)
end
end)
Report Abuse
lokkut is not online. lokkut
Joined: 18 Mar 2009
Total Posts: 1794
13 Jul 2015 01:56 PM
Apart from the fact this won't always work
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
13 Jul 2015 02:04 PM
What you mean
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
13 Jul 2015 02:23 PM
It may not be completely perfect but it's close enough
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
13 Jul 2015 02:34 PM
I'm gonna guess this is a free model because of how bad it is.
Report Abuse
Threatboy101 is not online. Threatboy101
Joined: 27 Oct 2012
Total Posts: 874
13 Jul 2015 02:35 PM
No its not a free model

--classic robloxians need to stop bashing
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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