So I've tried and tried and tried to fix this, but I have no idea how. I've asked TehIcyStar to help me, but this is all he could manage. The goal is to make it look like this https://cdn.discordapp.com/attachments/225572345631342592/414789154774450186/unknown.png but nothing happens. Instead I just get this https://cdn.discordapp.com/attachments/225572345631342592/414789268477837314/unknown.png here is the TagClean/Sword itself. I'm not good with words, but this is what I can manage to say and do.
r = game:service("RunService")
local UIS = game:GetService("UserInputService") -- grabs userinputservice
local damage = 2
local tagcleanable = false --variable for when player can press T to tagclean
local slash_damage = 2 --The punch is 3 because its is normal attack
local lunge_damage = 4 --Its by 5 when it gets stronger
sword = script.Parent.Handle
Tool = script.Parent
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
tagHumanoid(humanoid, vPlayer)
humanoid.Health = humanoid.Health - damage
wait(1)
untagHumanoid(humanoid)
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 ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
wait(.25)
swordOut()
wait(.25)
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.Handle.CanCollide = false
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
Tool.Handle.CanCollide = true
end
function swordOut()
Tool.Handle.CanCollide = false
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
Tool.Handle.CanCollide = true
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
wait(.5)
Tool.Enabled = true
end
function onEquipped()
tagcleanable = true
end
UIS.InputBegan:connect(function (input, _) -- recognizes input is being given
if input.KeyCode == Enum.KeyCode.T and tagcleanable then -- checks to see if the key pressed was the 'T' key
print("KeyPressed!!!")
game.ReplicatedStorage.TagOut:FireServer() -- send server the message to tag out
print("Sent message to server")
end
end)
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(function ()
tagcleanable = false
end)
connection = sword.Touched:connect(blow)
TagClean Script
local ChatService = game:GetService("Chat")
game.ReplicatedStorage.TagOut.OnServerEvent:connect(function (plyr)
if plyr then
if plyr.Character then
ChatService:Chat(plyr.Character.Head, "Tag", "Blue")
end
end
end)
i even have the Tagout at ReplicatedStorage where it's supposed to be. Thanks if you manage to help. You'll be my hero.
