Hey, developers. I’ve realized how annoying it is to keep track of calculations when changing the player’s walkspeed/jumppower. This is especially annoying when multiple scripts change the player’s movement.
There is a solution that provides a more organized, and less hacky way.
Here is an example of what the module can provide:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ModuleScript = require(ReplicatedStorage.ModuleScript)
game.Players.PlayerAdded:Connect(function(plr)
local newMovement = ModuleScript.new(plr)
newMovement:SetSpeed(16)
newMovement:Update()
end)
If you have multiple scripts, you can use the cache systems. This makes it much easier and simpler since you don’t need to create new movements each time.
local cacheMovement = ModuleScript:GetCache(plr) -- returns original movement or nil
cacheMovement:SetSpeed(16)
cacheMovement:Update()
There are also ways to use it for attributes.
If you want to use it and learn more about the docs, please visit the GitHub page.