I think it's a problem with my RemoteEvent script, I'm not really sure but here are the scripts.
LocalScript:
local tool = script.Parent tool.Equipped:connect(function(mouse) mouse.Button1Down:connect(function() tool.Kill:FireServer() end) end)
Script:
script.Parent.Kill.OnServerEvent:Connect(function() script.Parent.union.Touched:Connect(function(hit) if script.Parent.CanDamage.Value == true and hit.Parent:FindFirstChild("Humanoid") and hit.Parent:FindFirstChild("Creator") == nil then local bloodarea = {"UpperTorso", "LowerTorso", "Head"} local bloodface = {"Top", "Bottom", "Front", "Back", "Left", "Right"} local chosenarea = bloodarea[math.random(1,#bloodarea)] local chosenface = bloodface[math.random(1,#bloodface)] local blood = game.ReplicatedStorage.Blood:Clone() local creator = Instance.new("IntValue") creator.Name = "Creator" creator.Parent = script.Parent.Parent blood.EmissionDirection = chosenface blood.Parent = hit.Parent[chosenarea] script.Parent.CanDamage.Value = false hit.Parent.Humanoid:TakeDamage(100) end end) end)
I know making a new script is unefficient but I don't know how to script that well and what you are doing above is kind of hard to read. I honestly think it is a lot less challenging to use this script than to use an event. Make sure if you use my script that it is in a server script located under your sword's handle. It has a debounce if you don't want it to immeadiately kill someone it won't. This script might seem stupid but I hope it helps you.
-- DominusInfinitus
function debounce(func) --Debounce optional local isRunning = false return function(...) if not isRunning then isRunning = true func(...) isRunning = false end end end local Activater = script.Parent.Parent local damagePack = script.Parent local damageAmount = 0 local function OnActivated() --sets damage later so you wont get hurt damageAmount = -25 -- change value if you would like end Activater.Activated:Connect(OnActivated) local function OnUnEquipped() --If it isUnequipable but if not get rid of this part damageAmount = 0 end UnEquipper.Unequipped:Connect(OnUnEquipped) local function Ouch(otherPart) --Once you are holding sword touched event wont play for you local character = otherPart.Parent --defines character local humanoid = character:FindFirstChild("Humanoid") --defines humanoid if humanoid then local currentHealth = humanoid.Health local newHealth = currentHealth + damageAmount --add or subtract health. humanoid.Health = newHealth end end damagePack.Touched:Connect(debounce(Ouch))
I don't think You added this at the beginning of both the localScript and Script
-- I am assuming "Kill" is the RemoteEvent and it should be in ReplicatedStorage local RepStorage = game:GetService('ReplicatedStorage') local Kill = RepStorage.Kill -- Put this in first place