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

LoadString doesn't function in the workspace?

Asked by 6 years ago
Edited 6 years ago

I have this localscript that basically clones another script like this:

local input = script.Parent:WaitForChild("sb").editor.main
local run = script.Parent:WaitForChild("sb").run
local stop = script.Parent:WaitForChild("sb").stop
local save_load = script.Parent:WaitForChild("sb").save
local console = script.Parent:WaitForChild("sb").console
local head = script.Parent:WaitForChild("sb").head
local plr = game.Players.LocalPlayer
local count = 0
local closer = script.Parent.sb.closer
run.MouseButton1Down:Connect(function()
    count = count + 1
    local s = workspace.TEMP:Clone() --Cloning the script
    s.Parent = game:GetService("Workspace")
    print(s.Parent) --returns Workspace
    s.ss.Value = input.Text
    print(input.Text,s.ss.Value) --returns print("test")
    s.Name = plr.Name.."_script"..count
    print(s.Name) --returns PyccknnXakep_script1 
    s.Disabled = not s.Disabled
    print(s.Disabled) --returns false
    --checker
    if game:GetService("Workspace"):FindFirstChild(plr.Name.."_script"..count) then
        print("script found") --returns script found
    else
    print("attempting to make another") --doesnt return
    local s = script.Parent.Script:Clone()
    s.Parent = game:GetService("Workspace")
    s.source.Value = input.Text
    s.Name = plr.Name.."_script"..count
    s.Disabled = not s.Disabled
    end
end)
stop.MouseButton1Down:Connect(function()
    if count <= 0 then
        return warn("Please create a script before deleting it!")
    end
    local s2find = workspace:FindFirstChild(plr.Name.."_script"..count)
    if s2find then
    count = count - 1
    s2find:Destroy() --destroys the script 
    else return end
end)

Inside of the server script that is cloned:

wait()
loadstring(script.ss.Value)()

The weird thing is the script clones and everything, but the script doesn't load the value. Yes, LoadStringEnabledis turned on and so is FilteringEnabled. Any help?

1 answer

Log in to vote
0
Answered by 6 years ago

Oh, I got it. The value will only appear for the client, and not the server. So the server still sees the value as blank. Instead, use RemoteEvents.

0
How so? PyccknnXakep 1225 — 6y
0
Because since you changed the value on the client side, only the client will see it. The server will not see it nor the other clients. hiimgoodpack 2009 — 6y
0
Yeah but if the client sees it then why doesnt it load the string? PyccknnXakep 1225 — 6y
0
Because the server is loading the string, not the client. hiimgoodpack 2009 — 6y
View all comments (7 more)
0
Could you show me how to make it so it works throughout the server? PyccknnXakep 1225 — 6y
0
I know how to use remote events, I just don't know how to use them in this case. PyccknnXakep 1225 — 6y
0
Send the info what you want to be run using Remote events. hiimgoodpack 2009 — 6y
0
How could I send a script, as a string, in a remote event? And what would the remote event do? Change the value of the stringvalue inside of the script? Keep in mind i need to destroy the cloned script aswell. PyccknnXakep 1225 — 6y
0
Don't you remember how I made the client send info to the server to run in my game? https://pastebin.com/1FSCUKsV hiimgoodpack 2009 — 6y
0
Unfortunately, no, I don't remember. But this should work, I'll now redo my code now. Thanks! PyccknnXakep 1225 — 6y
0
Could I make it stop though? PyccknnXakep 1225 — 6y
Ad

Answer this question