This is HumanoidAttributes, a simple module meant to eliminate conflicts and adding modifiers to humanoid properties.
This module is very simple to use! We stop conflicts by adding keys to when we change any humanoid property and checking for the key if we want to change it again. We can add modifiers that are added onto the humanoid property with a given key.
local HumanoidAttributes = require(game.ServerStorage.HumanoidAttributes)
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player: Player)
player.CharacterAdded:Connect(function(Character: Model)
HumanoidAttributes.SetC(Character)
end)
end)
Npc Character
local HumanoidAttributes = require(game.ServerStorage.Modules.HumanoidAttributes)
workspace.DescendantAdded:Connect(function(descendant: Instance)
if descendant:FindFirstChildOfClass("Humanoid") then
HumanoidAttributes.SetC(descendant)
end
end)
if there are any bugs or questions please ask me
Discord: cact_
The reason we use a module to do that is so we don’t have conflicts
lets say we have a combat script to attack someone else, in this script the humanoid walkspeed is set to 6 then back to the original walkspeed of 16 after 1 second. Now lets say we have a running script that sets the humanoid walkspeed to 25. Using both of these scripts we could first fire the combat script then the run script, after 1 second the walkspeed should be 25 because we are running but is set back to 16 because of the combat script.
We can use HumanoidAttributes module to set a key to both scripts, In the combat script say we use the Set method and send the key as “Combat” and the Value as 6, after one second we can use the DestroySet method and send the key in as “Combat”. For the run script instead of using a set we can use a Modifier to set the runspeed, use the method AddModifier and send through the key which will be “Running” and set the value to 9, we set it to 9 instead of 25 because all the modifiers get added onto the base value.