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)