The issue im having is that multiple parts are created instead of one singular part, and I dont know what the issue is
here is a video:
local Placeables = script.Parent.Frame:GetChildren()
local part = game.Workspace.Part
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
for _, PlaceablePicked in pairs(Placeables) do
PlaceablePicked.MouseButton1Click:Connect(function()
local newModelPreview = PlaceablePicked.Model:Clone()
newModelPreview.Parent = workspace
newModelPreview.Transparency = 0.9
newModelPreview.Color = Color3.new(0.333333, 1, 0)
newModelPreview.Material = "Foil"
game:GetService("RunService").RenderStepped:Connect(function()
newModelPreview.Position = Vector3.new(Mouse.Hit.X, 0, Mouse.Hit.Z)
game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local endPos = newModelPreview.Position
newModelPreview:Destroy()
local finalModel = newModelPreview:Clone()
finalModel.Position = endPos
finalModel.Transparency = 0
finalModel.Parent = workspace
end
end
end)
end)
end)
end