Im new to the dev forum
You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I want to fix my building client script
-
What is the issue? Include screenshots / videos if possible!
Sometimes (Mostly when i lift my mouse) the script randomly selects parts that i don’t want it to -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Nothing i found on the dev forum helped me and i cant find the problem. No errors are outputted.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is my script… its very long.
local uis = game:GetService("UserInputService")
local players = game:GetService("Players")
local runS = game:GetService("RunService")
local player = players.LocalPlayer
local mouse = player:GetMouse()
local camera = workspace.CurrentCamera
local replicatedS = game:GetService("ReplicatedStorage")
local gui = script.Parent:WaitForChild("BuildGui")
local tool = player.Backpack:WaitForChild("Build")
local selectionBox = script.Parent:WaitForChild("SelectBox")
local hoverBox = script.Parent:WaitForChild("HoverBox")
local selectedParts = {} -- Table to store multiple selected parts
local mode = ""
local handles = script.Parent:WaitForChild("Handles")
local currentPartColor = Color3.fromRGB(163, 162, 165)
local currentPartMaterial = Enum.Material.Plastic
local onGui = false
local dragging = false
local clicking = false
local equipped = false
local shiftHeld = false -- Track if shift is held
local getGuiOnMouse = {}
local otherSelectionBoxes = {}
local selectionBoundingBox
local function updateSelectionBox()
if #selectedParts > 0 then
selectionBox.Adornee = selectedParts[1] -- Show selection box on the first selected part
if #selectedParts > 1 then
if selectionBoundingBox then
selectionBoundingBox:Destroy()
selectionBoundingBox = nil
end
local parents = {}
local model = Instance.new("Model", workspace)
local parts = {}
for i, part in ipairs(selectedParts) do
parents[i] = {part, part.Parent}
part.Parent = model
end
local boundingBox = Instance.new("Part")
boundingBox.Anchored = true
boundingBox.CanCollide = false
boundingBox.Transparency = 1
boundingBox.CanQuery = false
boundingBox.Locked = true
local cframe, size = model:GetBoundingBox()
boundingBox.CFrame = cframe
boundingBox.Size = size
boundingBox.Parent = workspace
selectionBox.Adornee = boundingBox
selectionBoundingBox = boundingBox
for _, part in pairs(parents) do
part[1].Parent = part[2]
end
model:Destroy()
end
else
selectionBox.Adornee = nil
end
end
local function legibleToSelect(p)
local model = p:FindFirstAncestorOfClass("Model")
local isAChar = false
if model then
local humanoid = model:FindFirstChildOfClass("Humanoid")
if humanoid then
isAChar = true
end
end
if p:IsA("BasePart") and not p.Locked and not isAChar and p.CanQuery and equipped then
return true
end
return false
end
local function clicked()
if not equipped then return end
if onGui then return end
local target = mouse.Target
if not target then
selectedParts = {}
updateSelectionBox()
return
end
if mode == "Picker" then
mode = "Paint"
currentPartColor = target.Color
gui:WaitForChild("ColorFrame"):WaitForChild("Preview").BackgroundColor3 = target.Color
return target.Color
end
if not legibleToSelect(target) then
selectedParts = {}
updateSelectionBox()
return
end
if not target.Locked then
if shiftHeld then
-- Add or remove target from selectedParts
local index = table.find(selectedParts, target)
if index then
table.remove(selectedParts, index)
else
table.insert(selectedParts, target)
end
else
selectedParts = {target}
end
else
selectedParts = {}
end
updateSelectionBox()
updatePositionAndRotationAndSizeTextboxes()
updateConfigureFrame()
end
local function cameraStill()
if uis.TouchEnabled then
camera.CameraType = Enum.CameraType.Scriptable
end
end
local function cameraNormal()
camera.CameraType = Enum.CameraType.Custom
end
cameraNormal()
local function onInputBegan(input, gameProcessedEvent)
if gameProcessedEvent then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
clicking = true
task.wait(0.1)
clicking = false
elseif input.KeyCode == Enum.KeyCode.LeftShift then
shiftHeld = true
end
end
local function onInputEnded(input, gameProcessedEvent)
if gameProcessedEvent then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
if clicking then
clicked()
end
elseif input.KeyCode == Enum.KeyCode.LeftShift then
shiftHeld = false
end
end
for _, button in pairs(gui:WaitForChild("ModeFrame"):GetChildren()) do
if button:IsA("TextButton") then
runS.RenderStepped:Connect(function()
button.Style = Enum.ButtonStyle.RobloxButton
if mode == button.Name then
button.Style = Enum.ButtonStyle.RobloxButtonDefault
end
end)
button.MouseButton1Click:Connect(function()
script.Button:Play()
if mode == button.Name then
mode = ""
return
end
mode = button.Name
end)
end
end
uis.InputBegan:Connect(onInputBegan)
uis.InputEnded:Connect(onInputEnded)
local boxColor = selectionBox.Color3
local moveI = 0
local rotateI = 0
runS.RenderStepped:Connect(function()
if equipped == false then
selectedParts = {}
mode = ""
end
gui.Enabled = equipped
updateSelectionBox()
equipped = tool.Parent == player.Character
local mousePos = uis:GetMouseLocation() - game:GetService("GuiService"):GetGuiInset()
getGuiOnMouse = player:WaitForChild("PlayerGui"):GetGuiObjectsAtPosition(mouse.X, mouse.Y)
for _, uiObject in pairs(getGuiOnMouse) do
if uiObject["BackgroundTransparency"] then
if uiObject["BackgroundTransparency"] >= 1 then
table.remove(getGuiOnMouse, table.find(getGuiOnMouse, uiObject))
end
end
if uiObject == gui:WaitForChild("DragFrame") then
table.remove(getGuiOnMouse, table.find(getGuiOnMouse, uiObject))
end
end
onGui = #getGuiOnMouse > 0
hoverBox.Adornee = nil
if mouse.Target then
if legibleToSelect(mouse.Target) and not table.find(selectedParts, mouse.Target) then
hoverBox.Adornee = mouse.Target
end
end
for _, targetHandles in pairs(handles:GetChildren()) do
targetHandles.Adornee = selectedParts[1] -- Show handles on the first selected part
targetHandles.Visible = false
end
if mode then
local targetHandles = handles:FindFirstChild(mode)
if targetHandles then
targetHandles.Visible = true
end
end
selectionBox.Parent = player.Character
selectionBox.Color3 = boxColor
replicatedS.Events:WaitForChild("UpdateInstance"):FireServer(selectionBox, "Adornee", selectedParts[1])
replicatedS.Events:WaitForChild("UpdateInstance"):FireServer(selectionBox, "Parent", selectionBox.Parent)
replicatedS.Events:WaitForChild("UpdateInstance"):FireServer(selectionBox, "Color3", Color3.new(1, 0.00015259, 0.210178))
gui:WaitForChild("Scroll").Visible = (mode == "Add")
gui:WaitForChild("ColorFrame").Visible = (mode == "Paint")
gui:WaitForChild("MaterialScroll").Visible = (mode == "Paint")
gui:WaitForChild("ConfigureFrame").Visible = (mode == "Configure")
moveI = tonumber(gui:WaitForChild("PositionFrame"):WaitForChild("MoveIncrement").Text)
rotateI = tonumber(gui:WaitForChild("PositionFrame"):WaitForChild("RotateIncrement").Text)
if mode == "Copy" and #selectedParts > 0 then
mode = "Move"
local clones = {}
for _, selectedPart in pairs(selectedParts) do
local clone = replicatedS:WaitForChild("Events"):WaitForChild("CloneBrick"):InvokeServer(selectedPart)
if clone then
table.insert(clones, clone)
end
end
selectedParts = clones
end
if mode == "Delete" and #selectedParts > 0 then
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("DestroyBrick"):FireServer(part)
end
selectedParts = {}
script.Button:Stop()
script.Splat:Play()
end
if moveI == nil or moveI <= 0 then
moveI = 0.01
end
if rotateI == nil or rotateI <= 0 then
rotateI = 0.1
end
for _, prompt in pairs(workspace:GetDescendants()) do
if prompt:IsA("ProximityPrompt") and prompt:HasTag("BuilderPrompt") then
prompt.Enabled = gui.Enabled
end
end
end)
-- MOVE HANDLES
local moveDist = 0
local initialPartCFrames = {}
local function SnapToGrid(val, gridSize)
return math.round(val / gridSize) * gridSize
end
function updatePositionAndRotationAndSizeTextboxes()
gui:WaitForChild("PositionFrame"):WaitForChild("MoveIncrement").Text = tostring(moveI)
gui:WaitForChild("PositionFrame"):WaitForChild("RotateIncrement").Text = tostring(rotateI)
if #selectedParts == 0 then
gui:WaitForChild("PositionFrame"):WaitForChild("Positon").Text = ""
gui:WaitForChild("PositionFrame"):WaitForChild("Orientation").Text = ""
gui:WaitForChild("PositionFrame"):WaitForChild("Size").Text = ""
return
end
local selectedPart = selectedParts[1]
gui:WaitForChild("PositionFrame"):WaitForChild("Positon").Text = tostring(selectedPart.Position)
gui:WaitForChild("PositionFrame"):WaitForChild("Orientation").Text = tostring(selectedPart.Orientation)
gui:WaitForChild("PositionFrame"):WaitForChild("Size").Text = tostring(selectedPart.Size)
end
handles:WaitForChild("Move").MouseButton1Down:Connect(function(face: Enum.NormalId)
cameraStill()
dragging = true
for _, selectedPart in pairs(selectedParts) do
initialPartCFrames[selectedPart] = selectedPart.CFrame
end
end)
local lastMoveCF = CFrame.identity
handles:WaitForChild("Move").MouseDrag:Connect(function(face: Enum.NormalId, distance: number)
local step = SnapToGrid(distance, moveI)
local direction = Vector3.FromNormalId(face)
local move = direction * step
local differences = {}
local part = selectedParts[1]
for _, otherPart in pairs(selectedParts) do
if otherPart ~= part then
local offset = part.CFrame:ToObjectSpace(otherPart.CFrame)
differences[otherPart] = offset
end
end
part.CFrame = initialPartCFrames[part] * CFrame.new(move)
for _, selectedPart in pairs(selectedParts) do
if selectedPart ~= part then
local offset = differences[selectedPart]
selectedPart.CFrame = part.CFrame * differences[selectedPart]
end
end
if selectedParts[1].CFrame ~= lastMoveCF then
script.Switch:Play()
end
lastMoveCF = selectedParts[1].CFrame
end)
handles:WaitForChild("Move").MouseButton1Up:Connect(function()
cameraNormal()
dragging = false
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "CFrame", part.CFrame)
end
updatePositionAndRotationAndSizeTextboxes()
end)
local oldDelta = 0
local smallestSize = 0.05
local surfaceAxis = {
[Enum.NormalId.Top] = 'Y',
[Enum.NormalId.Bottom] = 'Y',
[Enum.NormalId.Front] = 'Z',
[Enum.NormalId.Back] = 'Z',
[Enum.NormalId.Left] = 'X',
[Enum.NormalId.Right] = 'X'
}
handles:WaitForChild("Scale").MouseDrag:Connect(function(face, distance)
local delta = distance - oldDelta
if math.abs(delta * 1.125) >= moveI then
delta = math.round(delta / moveI) * moveI
local direction = Vector3.fromNormalId(face)
local size = Vector3.new(math.abs(direction.X), math.abs(direction.Y), math.abs(direction.Z))
for _, part in pairs(selectedParts) do
local endSize = part.Size + size * delta
if endSize[surfaceAxis[face]] > smallestSize then
part.Size = endSize
part:PivotTo(part.CFrame * CFrame.new(direction / 2 * delta))
oldDelta = distance
script.Switch3:Play()
end
end
end
end)
handles:WaitForChild("Scale").MouseButton1Up:Connect(function()
cameraNormal()
dragging = false
oldDelta = 0
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "CFrame", part.CFrame)
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Size", part.Size)
end
updatePositionAndRotationAndSizeTextboxes()
end)
handles:WaitForChild("Scale").MouseButton1Down:Connect(function()
cameraStill()
dragging = true
end)
local lastRotCF = CFrame.identity
handles:WaitForChild("Rotate").MouseDrag:Connect(function(axis, relativeAngle, delta)
relativeAngle = math.deg(relativeAngle)
local adjustedAngle = SnapToGrid(relativeAngle, rotateI)
local differences = {}
local part = selectedParts[1]
for _, otherPart in pairs(selectedParts) do
if otherPart ~= part then
local offset = part.CFrame:ToObjectSpace(otherPart.CFrame)
differences[otherPart] = offset
end
end
if axis == Enum.Axis.X then
part:PivotTo(initialPartCFrames[part] * CFrame.Angles(math.rad(adjustedAngle), 0, 0))
end
if axis == Enum.Axis.Y then
part:PivotTo(initialPartCFrames[part] * CFrame.Angles(0, math.rad(adjustedAngle), 0))
end
if axis == Enum.Axis.Z then
part:PivotTo(initialPartCFrames[part] * CFrame.Angles(0, 0, math.rad(adjustedAngle)))
end
for _, otherPart in pairs(selectedParts) do
if otherPart ~= part then
local offset = differences[otherPart]
otherPart.CFrame = part.CFrame * offset
end
end
if selectedParts[1].CFrame ~= lastRotCF then
script.Switch:Play()
end
lastRotCF = selectedParts[1].CFrame
end)
handles:WaitForChild("Rotate").MouseButton1Down:Connect(function()
for _, selectedPart in pairs(selectedParts) do
initialPartCFrames[selectedPart] = selectedPart.CFrame
end
cameraStill()
dragging = true
end)
handles:WaitForChild("Rotate").MouseButton1Up:Connect(function()
cameraNormal()
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "CFrame", part.CFrame)
end
updatePositionAndRotationAndSizeTextboxes()
script.Kerplunk:Play()
dragging = false
end)
-- POSITION SCALE AND ORIENTATION TEXT BOXES ------------------------------------------------------------
gui:WaitForChild("PositionFrame"):WaitForChild("Positon").FocusLost:Connect(function()
local positionTable = gui:WaitForChild("PositionFrame"):WaitForChild("Positon").Text:split(',')
local x = positionTable[1]
local y = positionTable[2]
local z = positionTable[3]
if x then x = tonumber(x) else return end
if y then y = tonumber(y) else return end
if z then z = tonumber(z) else return end
for _, part in pairs(selectedParts) do
part.Position = Vector3.new(x, y, z)
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Position", part.Position)
end
updatePositionAndRotationAndSizeTextboxes()
script.Splat:Play()
end)
gui:WaitForChild("PositionFrame"):WaitForChild("Size").FocusLost:Connect(function()
local sizeTable = gui:WaitForChild("PositionFrame"):WaitForChild("Size").Text:split(',')
local x = sizeTable[1]
local y = sizeTable[2]
local z = sizeTable[3]
if x then x = tonumber(x) else return end
if y then y = tonumber(y) else return end
if z then z = tonumber(z) else return end
for _, part in pairs(selectedParts) do
part.Size = Vector3.new(x, y, z)
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Size", part.Size)
end
updatePositionAndRotationAndSizeTextboxes()
script.Splat:Play()
end)
gui:WaitForChild("PositionFrame"):WaitForChild("Orientation").FocusLost:Connect(function()
local orientationTable = gui:WaitForChild("PositionFrame"):WaitForChild("Orientation").Text:split(',')
local x = orientationTable[1]
local y = orientationTable[2]
local z = orientationTable[3]
if x then x = tonumber(x) else return end
if y then y = tonumber(y) else return end
if z then z = tonumber(z) else return end
for _, part in pairs(selectedParts) do
part.Orientation = Vector3.new(x, y, z)
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Orientation", part.Orientation)
end
updatePositionAndRotationAndSizeTextboxes()
script.Splat:Play()
end)
-- ADDING PARTS TO THE WORKSPACE -------------------------------------------------------------------
local debounce = false
for _, part in pairs(replicatedS:WaitForChild("Parts"):GetChildren()) do
local newButton = gui:WaitForChild("Scroll"):WaitForChild("Sample"):Clone()
newButton.Name = part.Name
newButton.Visible = true
newButton.Parent = gui:WaitForChild("Scroll")
newButton:WaitForChild("NameLabel").Text = part.Name
local display = part:Clone()
display.Parent = newButton:WaitForChild("View")
display.CFrame = CFrame.new(0, 0, 0)
local distance = 5 + display.Size.Magnitude
local camera = Instance.new("Camera")
camera.Parent = newButton:WaitForChild("View")
camera.CFrame = CFrame.lookAt(Vector3.one * distance, Vector3.new(0, 0, 0))
camera.FieldOfView = 30
newButton.View.CurrentCamera = camera
newButton.Activated:Connect(function()
local newBrick = replicatedS:WaitForChild("Events"):WaitForChild("AddBrick"):InvokeServer(part, moveI)
if not newBrick then return end
mode = "Move"
script.Bass:Play()
end)
end
-- PAINTING PARTS
local materials = Enum.Material:GetEnumItems()
materials[Enum.Material.Air] = nil
for _, material in pairs(materials) do
local button = gui:WaitForChild("MaterialScroll"):WaitForChild("Sample"):Clone()
button.Name = material.Name
button.Text = material.Name
button.Visible = true
button.Parent = gui:WaitForChild("MaterialScroll")
button.Activated:Connect(function()
if #selectedParts == 0 then return end
currentPartMaterial = material
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Material", material)
script.ElectronicPingShort:Play()
end
end)
end
gui:WaitForChild("ColorFrame"):WaitForChild("Submit").Activated:Connect(function()
script.Paint:Play()
currentPartColor = gui:WaitForChild("ColorFrame"):WaitForChild("Preview").BackgroundColor3
if #selectedParts == 0 then return end
for _, part in pairs(selectedParts) do
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(part, "Color", currentPartColor)
end
end)
-- DRAG SELECTOR ----------------------------------------------------------------------------
local Frame = gui:WaitForChild("DragFrame")
local partsFolder = workspace.Parts
function selectPart(part) -- Customize for your specific case.
if table.find(selectedParts, part) then return end
table.insert(selectedParts, part)
end
gui:WaitForChild("ModeFrame"):WaitForChild("DragSelect").Visible = uis.TouchEnabled
local Corner1 = Vector2.zero
local DragConnection
uis.InputBegan:Connect(function(InputObject, GameProcessed)
task.wait()
if onGui then return end
if dragging then return end
if shiftHeld then return end
if uis.TouchEnabled then
if InputObject.UserInputType ~= Enum.UserInputType.Touch or mode ~= "DragSelect" then return end
else
if InputObject.UserInputType ~= Enum.UserInputType.MouseButton1 then return end
end
cameraStill()
Corner1 = Vector2.new(mouse.X, mouse.Y)
Frame.Position = UDim2.fromOffset(mouse.X, mouse.Y)
Frame.Size = UDim2.fromOffset(0, 0)
Frame.Visible = true
if DragConnection then DragConnection:Disconnect() end
DragConnection = mouse.Move:Connect(function()
Frame.Size = UDim2.fromOffset(mouse.X, mouse.Y) - Frame.Position
end)
end)
uis.InputEnded:Connect(function(InputObject, GameProcessed)
if uis.TouchEnabled then
if InputObject.UserInputType ~= Enum.UserInputType.Touch then return end
else
if InputObject.UserInputType ~= Enum.UserInputType.MouseButton1 then return end
end
if DragConnection then DragConnection:Disconnect()
else
return
end
Frame.Visible = false
cameraNormal()
--if shiftHeld then return end
local Corner2 = Vector2.new(mouse.X, mouse.Y)
local Size = Corner2 - Corner1
local Negate = Vector2.new(Size.X - math.abs(Size.X), Size.Y - math.abs(Size.Y)) / 2
Corner1 += Negate
Corner2 -= Negate
for _, part in ipairs(partsFolder:GetChildren()) do
if not legibleToSelect(part) then return end
local ScreenPosition = workspace.CurrentCamera:WorldToScreenPoint(part.Position)
if ScreenPosition.X < Corner1.X or
ScreenPosition.X > Corner2.X or
ScreenPosition.Y < Corner1.Y or
ScreenPosition.Y > Corner2.Y then continue end
selectPart(part)
end
end)
-- CONFIGURE FRAME ------------------------------------
function updateConfigureFrame()
if selectedParts[1] then
gui:WaitForChild("ConfigureFrame").TransparencyBox.Text = selectedParts[1].Transparency
gui:WaitForChild("ConfigureFrame").Reflectance.Text = selectedParts[1].Reflectance
gui:WaitForChild("ConfigureFrame").ColorBox.Text = tostring(selectedParts[1].Color)
gui:WaitForChild("ConfigureFrame").CanCollide.Text = "CanCollide: "..tostring(selectedParts[1].CanCollide)
gui:WaitForChild("ConfigureFrame").Anchored.Text = "Anchored: "..tostring(selectedParts[1].Anchored)
end
end
gui:WaitForChild("ConfigureFrame").TransparencyBox.FocusLost:Connect(function()
local num = tonumber(gui:WaitForChild("ConfigureFrame").TransparencyBox.Text)
if not num then return end
for _, selectedPart in pairs(selectedParts) do
selectedPart.Transparency = num
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(selectedPart, "Transparency", selectedPart.Transparency)
end
task.wait(0.1)
updateConfigureFrame()
end)
gui:WaitForChild("ConfigureFrame").Reflectance.FocusLost:Connect(function()
local num = tonumber(gui:WaitForChild("ConfigureFrame").Reflectance.Text)
if not num then return end
for _, selectedPart in pairs(selectedParts) do
selectedPart.Reflectance = num
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(selectedPart, "Reflectance", selectedPart.Reflectance)
end
task.wait(0.1)
updateConfigureFrame()
end)
local function stringToColor3(String)
local split = string.split(String, ",")
local R, G, B = split[1], split[2], split[3]
return Color3.new(R, G, B)
end
gui:WaitForChild("ConfigureFrame").ColorBox.FocusLost:Connect(function()
local color = stringToColor3(gui:WaitForChild("ConfigureFrame").ColorBox.Text)
if not color then return end
for _, selectedPart in pairs(selectedParts) do
selectedPart.Color = color
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(selectedPart, "Color", selectedPart.Color)
end
task.wait(0.1)
updateConfigureFrame()
end)
gui:WaitForChild("ConfigureFrame").CanCollide.Activated:Connect(function()
if not selectedParts[1] then return end
for _, selectedPart in pairs(selectedParts) do
selectedPart.CanCollide = not selectedParts[1].CanCollide
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(selectedPart, "CanCollide", selectedPart.CanCollide)
end
task.wait(0.1)
updateConfigureFrame()
end)
gui:WaitForChild("ConfigureFrame").Anchored.Activated:Connect(function()
if not selectedParts[1] then return end
for _, selectedPart in pairs(selectedParts) do
selectedPart.Anchored = not selectedParts[1].Anchored
replicatedS:WaitForChild("Events"):WaitForChild("UpdateInstance"):FireServer(selectedPart, "Anchored", selectedPart.Anchored)
end
task.wait(0.1)
updateConfigureFrame()
end)
-- prompts
local promptService = game:GetService("ProximityPromptService")
local promptPart = nil
promptService.PromptTriggered:Connect(function(prompt, playerWhoTriggered)
if player == playerWhoTriggered then
if prompt:HasTag("BuilderPrompt") and prompt.Parent and prompt.Parent:IsA("BasePart") then
promptPart = prompt.Parent
local frame = gui:WaitForChild("PromptFrames"):WaitForChild(prompt:GetAttribute("Frame"))
selectedParts = {prompt.Parent}
updateConfigureFrame()
mode = ""
for _, promptFrame in pairs(gui:WaitForChild("PromptFrames"):GetChildren()) do
promptFrame.Visible = false
end
frame.Visible = true
end
end
end)
-- prompt frames
for _, promptFrame in pairs(gui:WaitForChild("PromptFrames"):GetChildren()) do
local function onClose(finish)
promptFrame.Visible = false
if finish and promptPart then
if promptFrame.Name == "DecalChangerFrame" then
local decalId = promptFrame:WaitForChild("ID").Text
local transparency = promptFrame:WaitForChild("TransparencyBox").Text
replicatedS:WaitForChild("Events"):WaitForChild("AttributeInstance"):FireServer(promptPart, "DecalID", decalId)
replicatedS:WaitForChild("Events"):WaitForChild("AttributeInstance"):FireServer(promptPart, "DecalTransparency", transparency)
end
end
end
promptFrame:WaitForChild("Done").Activated:Connect(function()
onClose(true)
end)
promptFrame:WaitForChild("Cancel").Activated:Connect(function()
onClose(false)
end)
end
its a very messy script and its a local script in startergui
this is a video of the error: