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

Loadstring script not executing script?

Asked by
danglt 185
4 years ago

It doesent run the script on the server for some reason also wondering if you can use loadstrings on client side

Server Script

game.ReplicatedStorage.server.OnServerEvent:Connect(function(plr,exe)
    loadstring(exe)
end)

Local Script

script.Parent.MouseButton1Click:Connect(function()
    local exe = script.Parent.Parent.Parent.script.TextBox
    if script.Parent.Parent.Parent.Parent.server.Value == false then
        loadstring(exe.Text)
    elseif script.Parent.Parent.Parent.Parent.server.Value == true then
            print("Player has gamepass")
            game.ReplicatedStorage.server:FireServer(exe.Text)
    else
        print("player dont got it :(")
    end
end)
0
Is LoadStringEnabled set to true? tzmods 59 — 4y
0
yeas danglt 185 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

The Problem

The problem with your server-side code is that the loadstring function returns a function

It looks something like this:

loadstring("CODE_IN_HERE")()

Applying

Now, we must apply this fact.

So in your server-side code, you would type:

game.ReplicatedStorage.server.OnServerEvent:Connect(function(plr,exe)
      loadstring(exe)()
end)

Some Problems (Not relevant to the solution)

.loadstring makes exploiting (or hacking) very easy to do; look for another system that can replace loadstring.

.Try adding some server-side checks to verify that the player is not exploiting. These are known as sever-sanity checks. (In your code) You can check if the server BoolValue is true or false on the Server since the Client can manipulate values

0
Thank you, also im not very concerned about that since its an exploit gui danglt 185 — 4y
Ad

Answer this question