Introduction
Hello there! I made a module script that focuses on changing numberProperties ie WalkSpeed and other stuff like numberValue Module its a simple module people with basic knowledge of module script should be able to replicate this
Alright so here’s the basic stuff and the main focus
-
AllowMultipleScripts so I’ve always noticed every time I make a combat system with punches that slows the player and sprinting so when you do both at the same time they always collide and break the Humanoid.WalkSpeed causes it to either go faster or slower than the original, it was very easy to implement but most people get stuck on this problem so I made sure to add it here
you can disable it if you like
-
Debug not much really it just debugs and tell you if scripts are colliding
forced set to false
Okay! that’s that now it’s time to know how to use it considering you don’t know
-
First things first require the module!
ill just put mine in ReplicatedStorage
-
Next we call the setModifier function
you need to make sure your calling the function using a colon “:” not a dot now lets put in the arguments
-
Alright it works! but I want to revert it back to the original WalkSpeed to do that we need to use the function resetModifier
with the following arguments
Okay so it works wonderfully that’s really all to it I hope this module helps you at the very least thank you for reading through this, If you have any advice please do tell I’m willing to listen
Sprint script using said Module -
local UserInputService = game:GetService("UserInputService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local ValueModifier = require(ReplicatedStorage.Libraries.ValueModifier)
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character.Humanoid
local NewAnim = Instance.new("Animation", script)
NewAnim.AnimationId = "rbxassetid:// your animationId "
local Anim = Humanoid:LoadAnimation(script:WaitForChild("Animation"))
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
ValueModifier:setModifier(script, Humanoid, "WalkSpeed", 1.5)
Anim:Play()
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
ValueModifier:resetModifier(script, Humanoid, "WalkSpeed")
Anim:Stop()
end
end)
Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
if Humanoid.FloorMaterial ~= Enum.Material.Air and Humanoid.MoveDirection.Magnitude > 0 then
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.3), {FieldOfView = 80}):Play()
else
TweenService:Create(workspace.CurrentCamera, TweenInfo.new(0.7), {FieldOfView = 70}):Play()
end
end)