I think it's a problem with my RemoteEvent script, I'm not really sure but here are the scripts.
LocalScript:
1 | local tool = script.Parent |
2 |
3 | tool.Equipped:connect( function (mouse) |
4 | mouse.Button 1 Down:connect( function () |
5 | tool.Kill:FireServer() |
6 | end ) |
7 | end ) |
Script:
01 | script.Parent.Kill.OnServerEvent:Connect( function () |
02 | script.Parent.union.Touched:Connect( function (hit) |
03 | if script.Parent.CanDamage.Value = = true and hit.Parent:FindFirstChild( "Humanoid" ) and hit.Parent:FindFirstChild( "Creator" ) = = nil then |
04 | local bloodarea = { "UpperTorso" , "LowerTorso" , "Head" } |
05 | local bloodface = { "Top" , "Bottom" , "Front" , "Back" , "Left" , "Right" } |
06 | local chosenarea = bloodarea [ math.random( 1 ,#bloodarea) ] |
07 | local chosenface = bloodface [ math.random( 1 ,#bloodface) ] |
08 | local blood = game.ReplicatedStorage.Blood:Clone() |
09 | local creator = Instance.new( "IntValue" ) |
10 | creator.Name = "Creator" |
11 | creator.Parent = script.Parent.Parent |
12 | blood.EmissionDirection = chosenface |
13 | blood.Parent = hit.Parent [ chosenarea ] |
14 | script.Parent.CanDamage.Value = false |
15 | hit.Parent.Humanoid:TakeDamage( 100 ) |
16 | end |
17 | end ) |
18 | 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
01 | function debounce(func) --Debounce optional |
02 | local isRunning = false |
03 | return function (...) |
04 | if not isRunning then |
05 | isRunning = true |
06 |
07 | func(...) |
08 |
09 | isRunning = false |
10 | end |
11 | end |
12 | end |
13 |
14 | local Activater = script.Parent.Parent |
15 | local damagePack = script.Parent |
I don't think You added this at the beginning of both the localScript and Script
1 | -- I am assuming "Kill" is the RemoteEvent and it should be in ReplicatedStorage |
2 | local RepStorage = game:GetService( 'ReplicatedStorage' ) |
3 | local Kill = RepStorage.Kill |
4 | -- Put this in first place |