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

Is not a valid member of folder??

Asked by 4 years ago
Edited 4 years ago

I have a GUI in my game where you can select a block to place it. The GUI local script:

local current = workspace.CurrentBlock

script.Parent.MouseButton1Click:Connect(function()
    current.Value = "Brick"
end)

the Script in workspace:

local rs = game.ReplicatedStorage
local event = rs.GrassPlace
local current = workspace.CurrentBlock
local TemplateFolder = game.ServerStorage.TemplateBlocks
local blockFolder = game.workspace.Blocks

function place(plr,target,blocktype)
    if current then
        current = workspace.CurrentBlock
        local blockInFolder = TemplateFolder[current.Value]

        if blockInFolder then
            local newBlock = TemplateFolder[current.Value]:Clone()
            newBlock.Parent = blockFolder
            newBlock.Size = Vector3.new(4,4,4)
            newBlock.Anchored = true
            newBlock.Name = current.Value
            newBlock.CFrame = CFrame.new(target.Position) + Vector3.new(0,4,0)
            newBlock.Parent = workspace
        end


    end
end

event.OnServerEvent:Connect(place)

it's worth mentioning that in workspace I have a StringValue called CurrentBlock, which does change. I do nut understand why it's not working, I get the error "is not a valid member of Folder"

0
Network filtering would prevent your local script's change from being picked up by the server theking48989987 2147 — 4y
0
wut? NickIsANuke 217 — 4y
0
I updated my question. NickIsANuke 217 — 4y
0
idk mohamedeatpotatoes 67 — 4y

Answer this question