Having trouble with a simple script

Hello, I’m having trouble with this function where I load the Wood Chair about middle down the script.

The over script is a placement system like bloxburg’s building system.

Thanks!

local plr = game.Players.LocalPlayer
local char = script.Parent
local placementFunction = game.ReplicatedStorage.Placement
local mouse = plr:GetMouse()
local buildsFolder = game.ReplicatedStorage.Builds
local uis = game:GetService("UserInputService")
local runService = game:GetService("RunService")

local Wood_Chair = game.StarterGui.Main.Frame.Wood_Chair
local Hospital_Chair = game.StarterGui.Main.Frame.Hospital_Chair
local Wood_Table = game.StarterGui.Main.Frame.Wood_Table
local Blue_Chair = game.StarterGui.Main.Frame.Blue_Chair

local isBuilding = false
local isDeleting = false
local canPlace = true

local gridSize = 2
local currentBlock = nil
local currentBlockCFrame = nil
local animCFrame = nil

mouse.Button1Down:Connect(function()
	if isBuilding then
		if canPlace and currentBlock ~= nil and currentBlockCFrame ~= nil then
			placementFunction:InvokeServer(currentBlock.Name,currentBlockCFrame)
		end
	end
end)

		Wood_Chair.MouseButton1Click:Connect(function()
		if not isDeleting then
			if not isBuilding then
				isBuilding = true
				currentBlock = buildsFolder:GetChildren(Wood_Chair):Clone()
				currentBlock.Parent = game.Workspace:FindFirstChild(plr.Name.."'s Buildings")
				for _,part in pairs(currentBlock:GetChildren(Wood_Chair)) do
					if part ~= currentBlock.PrimaryPart and part:IsA("BasePart") then
						part.CanCollide = false
						part.Transparency = .75
					end
				end
				while isBuilding do
					local unitRay = mouse.UnitRay
					local ray = Ray.new(unitRay.Origin,unitRay.Direction * 100000)
					local _,pos = workspace:FindPartOnRayWithIgnoreList(ray,{char;currentBlock;})
					
					currentBlockCFrame = CFrame.new(math.floor(pos.X / gridSize) * gridSize,pos.Y + currentBlock.PrimaryPart.Size.Y/2,math.floor(pos.Z / gridSize) * gridSize)
					animCFrame = currentBlock.PrimaryPart.CFrame:Lerp(currentBlockCFrame,1/1.5)
					currentBlock:SetPrimaryPartCFrame(animCFrame)
					
					runService.RenderStepped:Wait()
				end
		else
				isBuilding = false
				currentBlock:Destroy()
				currentBlockCFrame = nil
				animCFrame = nil
			end
		end
	end)
3 Likes

I need specific information.
Is there an error? Or is there something wrong?

So I am trying to load the Wood Chair from the buildsFolder, which is in replicated storage, starting about the line of lua Wood_Chair.MouseButton1Click:Connect(function() is where I am having an issue getting it to work.

There is no error in the output window beyond this, ContentProvider:PreloadAsync() failed for rbxthumb://type=Asset&id=183435411&w=150&h=150

Hello! I’d suggest referring to the following YouTube video for some assistance:
How to make a placement system

Hope this helps!

1 Like