I have linked scripts in my weapons so I don't have to go in an edit every single one whenever I want to change it. The problem is, the scripts involve the scripts parent(it decides which animation to play based off a value in the tool), so it ends up using every single scripts parent. Is there any way to edit all of the scripts at once without linked scripts or have the scripts only get their own parent and not every other scripts parent?
--module script
local _M = {}
local A = false
local B = false
local rs = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
function _M.attack(player, tool, checker)
checker = true
local F = tool.Type.Value
local a = game:GetService("ReplicatedStorage").Animations:FindFirstChild(F)
if checker == true then
local h = player.Humanoid
local animTrack = h:LoadAnimation(a)
animTrack:Play()
wait(1)
checker = false
B = false
end
end
function _M.touch(hit, player, tool, checker)
local plr = player.Character
local h = hit.Parent
if h:FindFirstChild("Hit") and checker == true and B == false then
checker = true
local hum = h.Hit
local dmg = tool.Damage.Value
hum:TakeDamage(dmg)
B = true
if hum.Health <=0 then
local gold = plr.leaderstats.Gold
gold.Value = gold.Value +20
end
end
end
return _M
--server script(ill condense this with the local later)
local B = false
local e = false
local checker = script.Parent.Attacking.Value
local tool = script.Parent
local rs = game:GetService("ReplicatedStorage")
local player = tool.Parent.Parent.Character
local name = player.Name
local o = name.."swordout"
local f = rs.PlayerStuff
local so = f:FindFirstChild(o)
local players = game:GetService("Players")
local plr = players:FindFirstChild(player.Name)
local myModule = require(game.ServerScriptService.Attacker)
script.Parent.Equipped:Connect(function ()
e = true
end)
script.Parent.Unequipped:Connect(function()
e = false
end)
so.OnServerEvent:Connect(function()
if checker == false and e == true then
myModule.attack(player, tool, checker)
end
end)
function touch(hit, player, tool, checker)
if checker == true then
myModule.touch(hit)
end
end
tool.Handle.Touched:Connect(touch)
--local script
local A = false
local equip = false
local tool = script.Parent
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin and A == false and equip == true then
A = true
local rs = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local name = player.Name
local o = name.."swordout"
local f = rs.PlayerStuff
local so = f:FindFirstChild(o)
so:FireServer()
script.Parent.Handle.SlashSound:Play()
wait(1)
A = false
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Q)
script.Parent.Equipped:Connect(function ()
equip = true
end)
script.Parent.Unequipped:Connect(function()
equip = false
end)

5 comments
You should look into http://wiki.roblox.com/index.php?title=API:Class/ModuleScript
If I wanted to edit the activation script, would I have to go through every single one or could I use a linked script for that?
You can make the module return a function with parameters that affect what happens. Require the module and call the function with different parameters correlating to each tool
Now I have this weird glitch where if I attack with one qeapon in my backpack, I can't attack with any other weapon in my backpack except one added after it attacked.
But that's not our problem. We are only dealing with script edits. Not your other errors. New question