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"