Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Is there a way to edit several scripts at once without linked scripts?

Asked by
Viking359 161
7 years ago
Edited 7 years ago

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?

01--module script
02local _M = {}
03local A = false
04local B = false
05local rs = game:GetService("ReplicatedStorage")
06local players = game:GetService("Players")
07 
08function _M.attack(player, tool, checker)
09checker = true
10local F = tool.Type.Value
11local a = game:GetService("ReplicatedStorage").Animations:FindFirstChild(F)
12if checker == true then
13local h = player.Humanoid
14local animTrack = h:LoadAnimation(a)
15animTrack:Play()
View all 39 lines...
01--server script(ill condense this with the local later)
02local B = false
03local e = false
04local checker = script.Parent.Attacking.Value
05local tool = script.Parent
06local rs = game:GetService("ReplicatedStorage")
07local player = tool.Parent.Parent.Character
08local name = player.Name
09local o = name.."swordout"
10local f = rs.PlayerStuff
11local so = f:FindFirstChild(o)
12local players = game:GetService("Players")
13local plr = players:FindFirstChild(player.Name)
14local myModule = require(game.ServerScriptService.Attacker)
15 
View all 35 lines...
01--local script
02local A = false
03local equip = false
04local tool = script.Parent
05 
06function onKeyPress(actionName, userInputState, inputObject)
07    if userInputState == Enum.UserInputState.Begin and A == false and equip == true then
08A = true
09local rs = game:GetService("ReplicatedStorage")
10local player = game.Players.LocalPlayer
11local name = player.Name
12local o = name.."swordout"
13local f = rs.PlayerStuff
14local so = f:FindFirstChild(o)
15so:FireServer()
View all 29 lines...
0
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? Viking359 161 — 7y
0
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 Goulstem 8144 — 7y
0
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. Viking359 161 — 7y
0
But that's not our problem. We are only dealing with script edits. Not your other errors. New question H4X0MSYT 536 — 7y

1 answer

Log in to vote
0
Answered by
OfcPedroo 396 Moderation Voter
7 years ago
Edited 7 years ago

The only way is using a Module Script, but that's too hard to explain, so, I suggest you take a look at this page.

If this was helpful, please mark as the solution!

As always, good scripting.

Ad

Answer this question