I’m trying to have my button disconnect after its being clicked - but PlaceButton:Disconnect() says that it is unknown globally. How would I go about disconnecting it?
local PlaceButton = UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if PlacingStructure == true and goodToPlace == true then
local StructureCFrame = clientStructure.PrimaryPart.CFrame
PlacedStructure = PlaceStructure:InvokeServer(clientStructure.Name, StructureCFrame)
PlacingItem = nil
if PlacedStructure == true then
PlacingStructure = false
clientStructure:Destroy()
Render:Disconnect()
Rotates:Disconnect()
Rotate:Disconnect()
PlaceButton:Disconnect()
end
end
end
end)
local PlaceButton
PlaceButton = UIS.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if PlacingStructure == true and goodToPlace == true then
local StructureCFrame = clientStructure.PrimaryPart.CFrame
PlacedStructure = PlaceStructure:InvokeServer(clientStructure.Name, StructureCFrame)
PlacingItem = nil
if PlacedStructure == true then
PlacingStructure = false
clientStructure:Destroy()
Render:Disconnect()
Rotates:Disconnect()
Rotate:Disconnect()
PlaceButton:Disconnect()
end
end
end
end)