Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I actually made a jumping jacks script, and it's not working. Can anyone show me my error?

Asked by 4 years ago

So, I made a jumping jacks script. That when you jump it chats the number. But it seems like it's not working. Where is my error?

local User = game:GetService("VirtualUser")
local plr = game.Players.LocalPlayer
local isDoingJacks = false
local MaxAmnt = 999
local MinAmnt = 1
local AmountToDo = 1
local Count = 0
local kpCodes = {["A"] = "0x41", ["B"] = "0x42", ["C"] = "0x43", ["D"] = "0x44", ["E"] = "0x45", ["F"] = "0x46", ["G"] = "0x47", ["H"] = "0x48", ["I"] = "0x49", ["J"] = "0x4A", ["K"] = "0x4B", ["L"] = "0x4C", ["M"] = "0x4D", ["N"] = "0x4E", ["O"] = "0x4F", ["P"] = "0x50", ["Q"] = "0x51", ["R"] = "0x52", ["S"] = "0x53", ["T"] = "0x54", ["U"] = "0x55", ["V"] = "0x56", ["W"] = "0x57", ["X"] = "0x58", ["Y"] = "0x59", ["Z"] = "0x5A"}
local stringNumbers_Ones = {["0"] = "ZERO", ["1"] = "ONE", ["2"] = "TWO", ["3"] = "THREE", ["4"] = "FOUR", ["5"] = "FIVE", ["6"] = "SIX", ["7"] = "SEVEN", ["8"] = "EIGHT", ["9"] = "NINE"}
local stringNumbers_Tens = {["10"] = "TEN", ["20"] = "TWENTY", ["30"] = "THIRTY", ["40"] = "FORTY", ["50"] = "FIFTY", ["60"] = "SIXTY", ["70"] = "SEVENTY", ["80"] = "EIGHTY", ["90"] = "NINTY"}
local stringNumbers_Hundreds = {["100"] = "ONEHUNDRED", ["200"] = "TWOHUNDRED", ["300"] = "THREEHUNDRED", ["400"] = "FOURHUNDRED", ["500"] = "FIVEHUNDRED", ["600"] = "SIXHUNDRED", ["700"] = "SEVENHUNDRED", ["800"] = "EIGHTHUNDRED", ["900"] = "NINEHUNDRED"}
function ArrayToString(Array)
    local String = ""
    for i, v in ipairs(Array) do 
        String = String..tostring(v)
    end
    return String
end
function StringToArray(String)
    local Array = {}
    for i = 1, String:len() do
        table.insert(Array, String:sub(i,i))
    end
    return Array
end
function NumToStr(num)
    local str = tostring(num)
    local final_str = {}
    if string.len(str) == 1 then 
        local final_str = StringToArray(stringNumbers_Ones[str])
        table.insert(final_str, stringNumbers_Ones[str])
        return final_str
    elseif string.len(str) == 2 then 
        local final_str = StringToArray(stringNumbers_Tens[str])
        table.insert(final_str, stringNumbers_Tens[str])
        return final_str
    elseif string.len(str) == 3 then
        return str
    else
        return "Unsupported Number"
    end
end
function KeyUp()
    User:SetKeyUp(" ")
end 
function KeyDown()
    User:SetKeyDown(" ")
end
function Jump(wt)
    if wt then wait(wt) else wait(1) end
    KeyUp()
    wait()
    KeyDown()
    wait()
    KeyUp()
end
function Chat(msg, capital)
    wait()
    if capital then
        keypress(0x14) 
        keypress(tonumber(kpCodes[string.upper(msg)]))
        keypress(0x14)
        keypress(0x0D)
    else
        if msg:len() > 2 then
            local strin = {}
            for index, value in ipairs(StringToArray(msg)) do
                table.insert(strin, kpCodes[string.upper(value)])
            end
            for a, b in ipairs(strin) do
                keypress(tonumber(b))
            end
            keypress(0x0D)
        else
            keypress(tonumber(kpCodes[string.upper(msg)]))
            wait()
            keypress(0x0D)
        end
    end
    wait()
end
function Intialize(numberOfJumps)
    for a = 1, numberOfJumps, 1 do
        for i, v in ipairs(NumToStr(a)) do 
            wait()
            Chat(v)
            Jump()
        end
    end
end
wait(1)
Intialize(1)

1 answer

Log in to vote
0
Answered by 4 years ago

You proiblem is that your using stringNumbers_ in the wrong co routine. The metatables are essential when defining what you want to be referencing in the co routine. The IPairs is also not rooted to humanoid root part which creates a whole other seperate set of problems. This is my input to my best knowledge, sorry if any mistakes I try my best

-TheBestScripter0

0
I will accept your answer, if it works. Daniel8947 2 — 4y
Ad

Answer this question