So this is my Sword script and I don't want people to be able to press backspace to give their sword to other people. How would i do it and where would I place it in my script?. All help appreciated! Thanks!
r = game:service("RunService")
ching = false
Tool = script.Parent
sword = Tool:WaitForChild("Handle")
function blow(hit)
if ching == true then
return
end
local humanoid = hit.Parent:findFirstChild("Human")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local DD = vPlayer.DD
if humanoid then
ching = true
tagHumanoid(humanoid, vPlayer)
local damage = math.random(script.Parent.MinDmg.Value,script.Parent.MaxDmg.Value)+math.floor(vPlayer.leaderstats.Lvl.Value/5)
DD.Value = DD.Value + math.floor(damage)
humanoid:TakeDamage(damage)
local part = Instance.new("ScreenGui")
local part2 = Instance.new("TextLabel")
local c1 = script.FadeClean:Clone()
local c2 = script.TextRiser:Clone()
part2.FontSize = "Size18"
part2.Size = UDim2.new(0,50,0,50)
part2.Position = UDim2.new(0.5,0,0.25,0)
part2.BackgroundTransparency = 1
part2.Parent = part
c1.Parent = part2
c1.Disabled = false
c2.Parent = part2
c2.Disabled = false
part.Parent = vPlayer.PlayerGui
if (damage == 0) then
part2.TextColor3 = Color3.new(0/255,102/255,255/255)
else
part2.TextColor3 = Color3.new(255/255,255/255,255/255)
end
part2.Text = ""..damage..""
wait(0.4)
ching = false
spawn(function()
wait(.5)
untagHumanoid(humanoid)
end)
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid then
for i, tag in pairs(humanoid:GetChildren()) do
if tag.Name == "creator" and tag:IsA("ObjectValue") then
tag:Destroy()
end
end
end
end
function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
local force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0)
force.Parent = Tool.Parent.Torso
swordOut()
force:Destroy()
swordUp()
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then
return
end
attack()
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
connection = sword.Touched:connect(blow)

2 comments
Oh haha did not know that, thanks alot :)
Haha, no prob. Glad I could help.