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

storing a directory in a Value?

Asked by 4 years ago
Edited 4 years ago

lets say I want to get something from serverstorage:

game.ServerStorage.Script

now lets say I wanted to change that but I didnt want to go into the script to change it. would I be able to take "game.ServerStorage.Script" and put it in a value. that way if I change that value to "game.Workspace.Script" the script will use that to find said script. (I asked this question in chat and someone wanted me to make this question so they can answer it.)

here is an example:

local value = script.DirectoryVal--in this script is a stringvalue with its value set to: "game.ServerStorage.Script"


--so instead of this:
local wantedscript = game.ServerStorage.Script

--it would be this:
local wantedscript = value


--but it seems a stringvalue does not acomplish the desired task

1 answer

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

I was quite confused with your question but I'm pretty sure this is what you're looking for

Edit:

-- Script that handles the value:

 local valu = Instance.new("ObjectValue")
    valu.Name = "valu"
    valu.Parent = script
    repeat wait() until valu.Value ~= nil
    if game.ReplicatedStorage:FindFirstChild(valu.Value.Name) then
    print("found " .. valu.Value.Name)
    end

-- Script that sets the value:

repeat wait() until script.Parent.handler:FindFirstChild("valu")
script.Parent.handler.valu.Value = workspace.Baseplate


Ad

Answer this question