You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
I want to locate the error in this module script -
What is the issue?
So as you can see, the tool requests a module and the module is erroring. However, I do not know where the error is. Hopefully someone more knowledgeable can identify it.
Module:
local Debris = game:GetService(‘Debris’)
local InsertService = game:GetService(‘InsertService’)
local RbxUtility = require(game:GetService(“ReplicatedStorage”):
WaitForChild(“LoadLibrary”):WaitForChild(“RbxUtility”))
Create = RbxUtility.Create
local SwordEquipped = Create(“BoolValue”){
Value = false
}
local Swords = {
Classic = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 8, Lunge = 12};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Fancy = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 13, Lunge = 17};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Wooden = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 3, Slash = 6};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Breaker = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 10, Lunge = 30};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Claymore = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 10, Lunge = 20};
Grips = {
Up = CFrame.new(0, 0, -2.3499999, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -2.3499999, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Katana = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 10, Lunge = 20};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Katana2 = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 12, Lunge = 16};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Katana3 = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 10, Lunge = 15};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Katana4 = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 13, Lunge = 21};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
EpicKatana = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 15, Slash = 30, Lunge = 42};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
ElfBlade = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 13, Lunge = 20};
Grips = {
Up = CFrame.new(0.150000006, 0, -1.10000002, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0.150000006, 0, -1.10000002, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Crowbar = {
Tool = require(script:WaitForChild(‘Crowbar’)).Tool;
Sword = require(script:WaitForChild(‘Crowbar’)).Sword;
Functions = require(script:WaitForChild(‘Crowbar’)).Functions;
Damage = {Base = 5, Slash = 10, Lunge = 17};
Grips = {
Up = CFrame.new(0.349999994, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0.349999994, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
SpiderKnife = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 8, Lunge = 17};
Grips = {
Up = CFrame.new(0.0500000007, 0, -1.29999995, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0.0500000007, 0, -1.29999995, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Ruler = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 4, Slash = 4, Lunge = 6};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Nefertiti = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 4, Slash = 4, Lunge = 12};
Grips = {
Up = CFrame.new(0.0500000007, 0, -1.54999995, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0.0500000007, 0, -1.54999995, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Scimitar = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 4, Slash = 15, Lunge = 15};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
WoodenMallet = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 12, Slash = 12, Lunge = 12};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
HeroesAxe = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 18, Slash = 18, Lunge = 18};
Grips = {
Up = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.70000005, 0, 1, 0, 1, -0, 0, 0, 0, -1)
};
};
Cane = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 5, Slash = 18, Lunge = 18};
Grips = {
Up = CFrame.new(0.3, 0, 2, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, 2.4, 0, 1, -0, -1, 0, 0, 0, 0, 1)
};
};
ThorHammer = {
Tool = require(script:WaitForChild(‘Sword’)).Tool;
Sword = require(script:WaitForChild(‘Sword’)).Sword;
Functions = require(script:WaitForChild(‘Sword’)).Functions;
Damage = {Base = 6, Slash = 13, Lunge = 18};
Grips = {
Up = CFrame.new(0, 0, -1.2999999, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(0, 0, -1.2999999, 0, 1, -0, -1, 0, 0, 0, 0, 1)
};
};
[“8BitSword”] = {
Tool = require(script:WaitForChild(‘8BitSword’)).Tool;
Sword = require(script:WaitForChild(‘8BitSword’)).Sword;
Functions = require(script:WaitForChild(‘8BitSword’)).Functions;
Damage = {Base = 5, Slash = 20, Lunge = 20};
Grips = {
Up = CFrame.new(2, 0, -0.100000001, 0, 0, 1, 1, 0, 0, 0, 1, 0),
Out = CFrame.new(2, 0, -0.100000001, 0, 1, -0, -1, 0, 0, 0, 0, 1)
};
};
Trident = {
Tool = require(script:WaitForChild(‘Trident’)).Tool;
Sword = require(script:WaitForChild(‘Trident’)).Trident;
Functions = require(script:WaitForChild(‘Trident’)).Functions;
Damage = {Base = 0, Attack = 20};
};
BladeOfTheFederation = {
Tool = require(script:WaitForChild(‘BladeFederation’)).Tool;
Sword = require(script:WaitForChild(‘BladeFederation’)).Trident;
Functions = require(script:WaitForChild(‘BladeFederation’)).Functions;
Damage = {Base = 5, Slash = 8, Lunge = 12};
Grips = {
Up = CFrame.new(0, -2.20000005, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
Out = CFrame.new(0, -2.20000005, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0)
};
};
}
local Functions = {
TagHumanoid = function(humanoid, plr)
local CreatorTag = Create(“ObjectValue”){
Name = “creator”,
Value = plr,
}
Debris:AddItem(CreatorTag, 2)
CreatorTag.Parent = humanoid
end;
UntagHumanoid = function(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end;
CheckIfAlive = function(char, humanoid)
return (((char and char.Parent and humanoid and humanoid.Parent and humanoid.Health > 0) and true) or false)
end;
IsTeamMate = function(plr1, plr2)
return (plr1 and plr2 and not plr1.Neutral and not plr2.Neutral and plr1.TeamColor == plr2.TeamColor)
end;
InsertAsset = function(assetId)
local AssetModel = InsertService:LoadAsset(assetId)
local Asset = AssetModel:GetChildren()[1]:Clone()
if AssetModel and AssetModel.Parent then
AssetModel:Destroy()
end
return Asset
end;
}
SwordFunctions = {
Damage = function(attackingPlayer, char, dmg)
dmg = (dmg or 0)
local humanoid = char:FindFirstChildOfClass(“Humanoid”)
local torso = char:FindFirstChild(“HumanoidRootPart”)
if not humanoid or humanoid.Health == 0 or not torso then
return
end
Functions.UntagHumanoid(humanoid)
Functions.TagHumanoid(humanoid, attackingPlayer)
humanoid:TakeDamage(dmg)
end;
GetSword = function(version)
local SwordVersion = Swords[version] or Swords.Classic
local SwordModel = SwordVersion.Sword
if type(SwordModel) == "number" then
return Functions.InsertAsset(SwordVersion.Sword)
elseif type(SwordModel) == "userdata" then
return SwordModel:Clone()
end
end;
GetData = function(version)
local SwordVersion = Swords[version] or Swords.Classic
return SwordVersion
end;
CreateConfiguration = function(tool, data)
local Handle = tool:FindFirstChild('Handle')
if not Handle then return end
local Character = tool.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local Humanoid = Character:FindFirstChildOfClass('Humanoid')
local Configuration = Instance.new("Configuration")
local DamageValue = Instance.new("IntValue")
DamageValue.Value = data.Damage.Base
DamageValue.Name = "Damage"
DamageValue.Parent = Configuration
if data.Functions.LoadSounds then
data.Functions.LoadSounds(Handle)
end
Configuration.Parent = tool
local Debounce = false
Handle.Touched:Connect(function(hit)
if not hit or not hit.Parent or Functions.CheckIfAlive(Character, Humanoid) or Debounce then return end
local AttackingCharacter = hit.Parent
if AttackingCharacter then
Debounce = true
SwordFunctions.Damage(Player, AttackingCharacter, DamageValue.Value)
wait(0.05)
Debounce = false
end
end)
return Configuration
end;
}
return {
Swords = Swords;
Functions = Functions;
SwordFunctions = SwordFunctions;
}