Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make this do 5 damage per arrow?

It's a arrow trap I made, but I only know how to make it break your joints when the arrow collides with you. Anyways of making it do only 5 damage per arrow?

function Stick(x, y)
	weld = Instance.new("Weld") 
	weld.Part0 = x
	weld.Part1 = y
	local HitPos = x.Position
	local CJ = CFrame.new(HitPos) 
	local C0 = x.CFrame:inverse() * CJ 
	local C1 = y.CFrame:inverse() * CJ 
	weld.C0 = C0 
	weld.C1 = C1 
	weld.Parent = x
end

function onTouched(hit)
local player = Game.Players:FindFirstChild(hit.Parent.Name)
if player ~= nil then
local arrow = Instance.new("Model",script.Parent.Parent)
arrow.Name = "Arrow"
local base = Instance.new("Part",arrow)
base.BrickColor = BrickColor.new("Dark orange")
base.CanCollide = false
base.FormFactor = "Symmetric"
base.Size = Vector3.new(1,2,1)
base.CFrame = script.Parent.Parent.Shooter.CFrame
local mesh = Instance.new("CylinderMesh",base)
mesh.Scale = Vector3.new(0.35,1,0.35)
local tip = Instance.new("Part",arrow)
tip.BrickColor = BrickColor.new("Really black")
tip.CanCollide = false
tip.FormFactor = "Symmetric"
tip.Size = Vector3.new(1,2,1)
tip.CFrame = base.CFrame
tip.CFrame = tip.CFrame + tip.CFrame.lookVector * 1.5
local mesh = Instance.new("SpecialMesh",tip)
mesh.MeshId = "http://www.roblox.com/asset/?id=1033714"
mesh.MeshType = "FileMesh"
mesh.Scale = Vector3.new(0.3,1.5,0.3)
base.CFrame = base.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
tip.CFrame = tip.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0)
Stick(base, tip)
local bv = Instance.new("BodyVelocity",tip)
bv.velocity = script.Parent.Parent.Shooter.CFrame.lookVector * script.Parent.Parent.Configuration.Speed.Value
local basehurt = base.Touched:connect(function(touched)
local player = Game.Players:FindFirstChild(touched.Parent.Name)
if player ~= nil then
player.Character:BreakJoints()
end
end)
local tiphurt = tip.Touched:connect(function(touched)
local player = Game.Players:FindFirstChild(touched.Parent.Name)
if player ~= nil then
player.Character:BreakJoints()
end
end)
wait(3)
basehurt:disconnect()
tiphurt:disconnect()
arrow:Remove()
end
end

script.Parent.Touched:connect(onTouched)

1 comment

0

Please tab your code. It makes it much easier to read.

2 answers

✓ Accepted answer

Change line 52 to

player.Character:FindFirstChild("Humanoid"):TakeDamage(5)
Damage = game.Players:FindFirstChild("Humanoid")

		Damage = -5

4 comments

0

This is not even slightly close to being correct.

0

I agree. I'm an amateur scripter, and I know that's not even correct, BlueTaslem.

0

sorry i am a very beginner scripter

0

Don't try to help if you don't know what you're talking about, it'll only confuse the OP more.

This discussion is preserved as it was. New answers, comments, and votes are closed.