The script has a problem I tried to solve but it does not work here I show you an image that Sandbox Placement I did with a tutorial but I already saw the tutorial 5 times but it does not work for me it is still the same if someone can please check the code for me would be very grateful
that’s the local script that goes in gui --StarterGui –
local placementHandler = require(script:WaitForChild(“PlacementModule”))
local base = workspace.Base
local items = game:GetService(“ReplicatedStorage”).Items
local plane = placementHandler.new(base.Baseplate, base.ItemHolder, 3)
local texBox = script.Parent:WaitForChild(“TextBox”)
local dummyModel
local signal
local currentItemName
local function cancelPlacement()
if (dummyModel) then
plane:disable()
if (dummyModel.Parent) then
dummyModel:Destroy()
end
dummyModel = nil
signal = nil
currentItemName = nil
end
end
local function initiatePlacement(itemName)
cancelPlacement()
dummyModel = items[itemName]:clone()
currentItemName = itemName
for _, object in pairs(dummyModel:GetChildren()) do
if (object:IsA("BasePart")) then
object.CanCollide = false
end
end
dummyModel.Parent = workspace
local signal = plane:enable(dummyModel)
signal:connect(function(location, _)
game:GetService("ReplicatedStorage").ClientPlaced:FireServer(currentItemName, location)
cancelPlacement()
end)
end
texBox.FocusLost:connect(function(enterPressed)
if (enterPressed) then
local text = texBox.Text
if (items:FindFirstChild(text)) then
initiatePlacement(text)
end
end
end)
and that’s a normal script – ServerScriptService –
local items = game:GetService(“ReplicatedStorage”).Items
game:GetService(“ReplicatedStorage”).ClientPlaced.OnServerEvent:Connect(function(player, itemName, location)
local itemTemplate = items:FindFirstChild(itemName)
if (itemTemplate) then
local item = itemTemplate:clone()
item.Parent = workspace.Base.ItemHolder
item:SetPrimaryPartCFrame(location)
end
end)