|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 08 Jan 2016 02:45 PM |
| Nevermind it works fine, just not in singleplayer |
|
|
| Report Abuse |
|
|