Ad
Log in to vote
0

The Math in my sprint script won't fully work, how do I fix this?

Asked by 2 days ago

In line 29 It won't divide by 5 like I told it to but it will add 16

local Player = game:GetService("Players").LocalPlayer
local PlrStats = Player:WaitForChild("PlrStats")
local Agil = PlrStats:WaitForChild("Agility")

local mouse = game.Players.LocalPlayer:GetMouse()
local running = false

function getTool()  
    for _, kid in ipairs(script.Parent:GetChildren()) do
        if kid.className == "Tool" then return kid end
    end
    return nil
end


mouse.KeyDown:connect(function (key) -- Run function
    key = string.lower(key)
    if string.byte(key) == 48 then
        running = true
        local keyConnection = mouse.KeyUp:connect(function (key)
            if string.byte(key) == 48 then
                running = false
            end
        end)
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (70+(i*2))
            wait()
        end
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = ((Agil.Value) / 5 ) + 16
        repeat wait () until running == false
        keyConnection:disconnect()
        game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
        for i = 1,5 do
            game.Workspace.CurrentCamera.FieldOfView = (80-(i*2))
            wait()
        end
    end
end)
0
Could you please tell what the output log shows when attempting to run this script? FrindowYT 283 — 2d
0
isnt it fixed Xapelize 1835 — 2d

Answer this question