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

Loadstring problems??? [Values]

Asked by 10 years ago

I have no output or ypcall(function error...

Gravity_Cmd(1,'Execute command','Exe','Exection Script',function(Plr,Msg)
    local Run,Error=ypcall(function()
        local val=Instance.new('StringValue',script)
        val.Value=Msg
        wait()
        loadstring(val.Value)
        delay(3,function()
            val:remove()
        end)
    end)
    if not Run then Output(20,Plr,'WARNING : '..Error,'Deep orange',function() end) end
end)

2 answers

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

The problem is you set up the loadstring function but never called it.

loadstring(val.Value) --Yours
loadstring(val.Value)() --Mine

Also there's no need to put it in a stringvalue.. so to fix;

Gravity_Cmd(1,'Execute command','Exe','Exection Script',function(Plr,Msg)
    local Run,Error=ypcall(function()
            loadstring(Msg)()
    end)
    if not Run then 
        Output(20,Plr,'WARNING : '..Error,'Deep orange',function() end) 
    end
end)
0
Im so stupid why didnt I think of that.. xD MessorAdmin 598 — 10y
Ad
Log in to vote
2
Answered by
Froast 5
10 years ago

If you mean the string isn't running than it's a pretty simple mistake that I often make as well:

loadstring(val.Value)()
0
And I'm guessing you put it in a StringValue because it wasn't working before? You can just do "loadstring(Msg)() Froast 5 — 10y

Answer this question