Im making a game like Super Mario 64, and so I wanted to implement a velocity script that would make the player run faster while there running overtime, I want to find ways that I can improve this script, whether it be for increasing player performance or fixing flaws and or exploits / ways players can abuse this script.
local humanoid = script.Parent:FindFirstChildOfClass("Humanoid")
local root = script.Parent:WaitForChild("HumanoidRootPart")
local UserInputService = game:GetService('UserInputService')
local KEYS = {Enum.KeyCode.W, Enum.KeyCode.S, Enum.KeyCode.A, Enum.KeyCode.D}
local function isKeyDown()
for _, key in KEYS do
if UserInputService:IsKeyDown(key) then
return true
end
end
return false
end
while task.wait() do
local result = isKeyDown()
if humanoid then
task.wait(3.3)
if humanoid.WalkSpeed == 16 then
if result then
for i = 1, 8 do
if humanoid.WalkSpeed == 32 then
break
end
task.wait(0.008)
humanoid.WalkSpeed += 2
end
end
end
if not result then
for i = 1, 8 do
if humanoid.WalkSpeed == 16 then
break
end
task.wait(0.008)
humanoid.WalkSpeed -= 2
end
end
end
end