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 » Game Design
Home Search
 

Sorry for wrong thread but, help me with this script

Previous Thread :: Next Thread 
DatBlueDerp is not online. DatBlueDerp
Joined: 17 Feb 2013
Total Posts: 28
07 Jan 2016 09:01 PM
so I have this script that I mostly made myself, it's for a bow, I'm trying to get it not to Teamkill when shot

here is the script:

local player = game.Players.LocalPlayer
local char = player.Character


script.Parent.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
script.Disabled = true
local mH = mouse.Hit
local arrow = Shoot()
arrow.CFrame = script.Parent.Arrow.CFrame * CFrame.new(char.Torso.CFrame.lookVector * 0)
arrow.CFrame = CFrame.new(arrow.Position, mH.p)
arrow.BodyVelocity.velocity = arrow.CFrame.lookVector * 50
arrow.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
end
wait(3)
script.Disabled = false
end)
end)
end)

function Shoot()
local ArrowClone = script.Parent.Arrow:Clone()
ArrowClone.Parent = game.Workspace
ArrowClone.CanCollide = false
ArrowClone.Transparency = 0
Instance.new("BodyVelocity", ArrowClone)
return ArrowClone
end
Report Abuse
LilMcManiac is online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
07 Jan 2016 10:55 PM
Incorporate this, into the script.


local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.TeamColor == game.Players.LocalPlayer.TeamColor then
print("Do not kill!")
else
--kill them
end
Report Abuse
DatBlueDerp is not online. DatBlueDerp
Joined: 17 Feb 2013
Total Posts: 28
08 Jan 2016 02:25 PM
Thanks!
Report Abuse
DatBlueDerp is not online. DatBlueDerp
Joined: 17 Feb 2013
Total Posts: 28
08 Jan 2016 02:33 PM
It's not working, what line should I put that in? when I try putting it in line 13 the bow shoots once then you can never shoot it again
Report Abuse
DatBlueDerp is not online. DatBlueDerp
Joined: 17 Feb 2013
Total Posts: 28
08 Jan 2016 02:45 PM
Nevermind it works fine, just not in singleplayer
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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